Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
What do the typscript parameters between {} mean?

In the following piece of typescript code I don't understand why the data parameter is between curly brackets and why it has a : followed by the same data object with a type specification. What does this mean?

addArrivingTruckSuggestions(state: ITruckState, { data }: { data: IOperationalTruck[] }) {
        state.arrivingTruckSuggestions = searchService.createTruckSuggestions(data);
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This function has two parameters, state, and an object containing data.

The state object has a type of ITruckState. Straight forward enough.

The next parameter must be an object, but the only property this function cares about is data. This is why there are curly braces around data, it is being destructured from the wrapper object that is passed in. The second set of curly braces is to define datas type. It is wrapped in curly braces because only the data property is given a type.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!