Description
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,
`
demo
<script lang="ts"> import { Component, Vue } from 'vue-property-decorator';@component({
components: {
},
})
export default class Demo extends Vue {}
</script>`
`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<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>> import Demo No overload matches this call. Overload 1 of 2, '(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>>>', gave the following error. Argument of type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' is not assignable to parameter of type 'PluginObject<unknown> | PluginFunction<unknown>'. Property 'install' is missing in type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' but required in type 'PluginObject<unknown>'. Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>>>', gave the following error. Argument of type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'. Property 'install' is missing in type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' but required in type 'PluginObject<any>'.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!