在vue3中使用typescript,有可能会提示cannot find module错误,但是实际运行是正常的。
解决方法,在项目中找到shims-vue.d.ts文件,改成
declare module "*.vue" {
import type { DefineComponent } from "vue";
import Vue from "vue";
const component: DefineComponent<{}, {}, any> | Vue;
export default component;
}
DefineComponent是本来就有的,只需要添加一个Vue,让类型支持Vue就行。