vuejs / vue-class-component

ES / TypeScript decorator for class-style Vue components.
MIT License
5.81k stars 431 forks source link

(alias) const Demo: VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>> #626

Open ranwenqi opened 1 year ago

ranwenqi commented 1 year ago

I want to use ts, vue2 and vue-class-component to develop a set of my own UI library, when I create a new demo, `

` `import { VueConstructor } from 'vue'; import Demo from './src/main.vue'; (Demo).install = (app: VueConstructor) => { app.component(Demo.name, Demo); } export default Demo; ` At this point I want to use it locally, test-ui/examples/main.ts `import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import '../components/css/demo.scss'; import Demo from '../components/lib/demo/src/index'; Vue.use(Demo); Vue.config.productionTip = false new Vue({ router, store, render: h => h(App) }).$mount('#app')` Vue.use(Demo); error: `(alias) const Demo: VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue>> import Demo No overload matches this call. Overload 1 of 2, '(plugin: PluginObject | PluginFunction, options?: unknown): VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue<...>>>', gave the following error. Argument of type 'VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue, Record, never, never, ...>>>' is not assignable to parameter of type 'PluginObject | PluginFunction'. Property 'install' is missing in type 'VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue, Record, never, never, ...>>>' but required in type 'PluginObject'. Overload 2 of 2, '(plugin: PluginObject | PluginFunction, ...options: any[]): VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue<...>>>', gave the following error. Argument of type 'VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue, Record, never, never, ...>>>' is not assignable to parameter of type 'PluginObject | PluginFunction'. Property 'install' is missing in type 'VueConstructor, Record, never, never, (event: string, ...args: any[]) => Vue, Record, never, never, ...>>>' but required in type 'PluginObject'.ts(2769) plugin.d.ts(6, 3): 'install' is declared here. plugin.d.ts(6, 3): 'install' is declared here.` I don't know what the problem is. I hope you can help me. Thank you very much!
dean5277 commented 1 year ago

vue return version 2.7.8