My goal is to create a custom type for an object property, but I am encountering some issues with the connection. Any suggestions on how to resolve this would be greatly appreciated :-)
import {
defineComponent,
PropType
} from 'vue'
interface IconType {
class: string
file: string
}
export default defineComponent({
props: {
icon: {
icon: Object as PropType<IconType>,
required: true
}
},
setup (props) {
// TS2571: Object (props.icon) is of type 'unknown'.
const iconPath = `map.svg#${props.icon.file}`
return {
iconPath
}
}
})
The TypeChecker indicates that the icon is being treated as type any
:
https://i.sstatic.net/oQhQh.png