Is there a way to fix this TypeScript error? To provide some background, I am working with the Vue 3 Composition API where I need to use the result to determine if a default option value should be displayed as
<option ... selected v-if="!isMatch">
.
The object is of type 'unknown'.
The error is specifically pointing to the second 'option'.
props:{
value: {
required: true,
type: String,
},
options: {
required: true,
type: Array,
},
}
setup(props){
const isMatch = () => props.options.find(option => {
return option['code'] === props.value
})
return { isMatch }
}
Example 'Options' Data
[
{
"code": "CA",
"name": "Canada"
},
{
"code": "US",
"name": "United States"
}
]