I'm currently trying to provide a generic type in a Vue component, but I'm unsure of how to do this from the caller.
Take the following component as an example:
export default class Toggle<T> extends Vue {
@Prop({ default: {} }) private payload!: T;
@Prop(Function) private handleCallback!: (payload: T) => Promise<any>;
}
How can I specify the type for T
when calling it like this?
<toggle :payload="{propOfT: 'value of T'}" :handleCallback='someCallbackFn'/>