Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda