Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda