VUE 3+TS “类型“DefineComponent<{}, {}, any>”的参数不能赋给类型“Plugin_2”的参数

vue3+ts,编辑器提示报错:参数不能赋给类型。要开启什么ts配置才能去除?

vue2迁移到vue3经常发生的错误,定义好组件,main.ts报错,即使改为app.use(emp*** as any),虽然不报错,但运行时还是报错,找不到文件。

改写shims.vue.d.ts即可

const component: DefineComponent<{}, {}, any>;

改为:

const component: ReturnType<typeof defineComponent> ;

类型不写死

猜你喜欢

转载自blog.csdn.net/weixin_44821114/article/details/132983221