Export type `DefineComponent`

This issue has been tracked since 2022-08-16.

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
    >
  }
}
More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-10-03
Star Count 199770
Watcher Count 6094
Fork Count 32877
Issue Count 590

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date