How do I resolve the following typescript error? For context, I am using the Vue 3 Composition API where I ultimately am using the result to specify whether or not a default option value should be <option ... selected v-if="!isMatch">.
Object is of type 'unknown'.
The error is highlighting 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"
}
]
propssetup part? By the looks of how you are using it on the template, I think RoToRa is right, you might want to useArray.prototype.someinstead offind. Need more context here.computedforisMatch