我在使用create-vue脚手架创建vue工程化项目时,发现建出来的main.ts文件里面,在import App from './App.vue'行显示:
Vue: Could not find a declaration file for module ./App.vue .
implicitly has an any type.
解决方案:
在main.ts文件的同级下新建文件 shims-vue.d.ts
declare module '*.vue' {
import { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
返回等待重新加载,或者手动重新加载,此时问题解决。