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

117
Visualizações
Problem returning a value with typescript

I'm trying to return a value with typescript but I always end up getting the following error:

Unsafe return of an any typed value.

This error is generated through a function in the @update of a select.

          <q-select
            outlined
            class="q-mb-lg"
            :options="rolesOptions"
            option-value="value"
            option-label="label"                
            :label="$t('Users.form.role')"
            v-model="fieldStates.role"
            @update:model-value="val => teste(val)" 
          />

This here would be my return, which I expect to receive the value of an option.

 const teste = ({value} : {value: any}) => {
   console.log('test: ', value)
   return value
 }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use generics to avoid the use of any.

const teste = <T>({value} : {value: T}) => {
   console.log('test: ', value)
   return value
}
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