The key is *.vue file not included in your env options.
If you have env.d.ts in your project, add these lines to it.
1 2 3 4 5 |
declare module '*.vue' { import { DefineComponent } from "vue" const component: DefineComponent<{}, {}, any> export default component } |
If your project have file tsconfig.json
Modify the “include” section to cover the full path of your .vue file.
My original lines with above error:
1 |
"include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.tsx", "src/**/*.d.ts"], |
But my project have file path like src/view/login/index.vue, it’s obviously not covered by the above pattern.
Just add “src/**/**/*.vue”, problem resolved.
Plus: Or just edit the tsconfig.json forced IDE refreshing?