-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
What problem does this feature solve?
Most Vue 2 third-party libraries do not provide types for components. Therefore, they cannot profit type checking and intellisense provided by Volar. It may be good to export type DefineComponent
just like in Vue 3, so that users can manually shim component types or create PR to add TypeScript support for those Vue2 libraries without changing source code written in Vue <= 2.6.
What does the proposed API look like?
To manually define type of a component in Vue 2.7, we can:
import type { DefineComponent, VNode } from 'vue'
declare module '@vue/runtime-dom' {
export interface GlobalComponents {
MyComponent: DefineComponent<
Props,
{
$scopedSlots: {
slotName: ({args: {propName: propType}}) => VNode[]
}
},
{},
{},
Methods
>
}
}
Metadata
Metadata
Assignees
Labels
No labels