'How to set type of a parameter to Vue Component
I have a function that takes a component as a parameter in typescript and I want to set its type to 'VueComponent'?
function callback(component: VueComponent???){
// some code
}
Solution 1:[1]
Please take a look at the following typings
https://github.com/vuejs/vue/blob/dev/types/options.d.ts#L10
export type Component<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> =
| typeof Vue
| FunctionalComponentOptions<Props>
| ComponentOptions<never, Data, Methods, Computed, Props>
Both Component and FunctionalComponentOptions are exported by the Vue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexander Alexandrov |
