I'm trying to return a value with typescript but I always end up getting the following error:
Unsafe return of an
anytyped 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
}
You can use generics to avoid the use of any.
const teste = <T>({value} : {value: T}) => {
console.log('test: ', value)
return value
}