I have a prop called sortSearch which is a function or callback from parent caller.
type SortSearchInterface = (
currentSort: string,
currentSortDir: string
) => void;
export default defineComponent({
props: {
//sortSearch: {
//type: Function as PropType<(currentSort: string, currentSortDir: string)=> void>
// type: Function as PropType<SortSearchInterface>|undefined
// }
sortSearch: Function as PropType<SortSearchInterface>,
},
When attempting to call this function I get the following error Cannot invoke an object which is possibly 'undefined':
// Cannot invoke an object which is possibly 'undefined'.Vetur(2722)
//props.sortSearch(s, state.currentSortDir);
With my brief googling found very limited examples / documentation on this and any help appreciated.