vue3+ts项目的shims.d.ts文件报错
问题点
import type { DefineComponent } from 'vue'这里花括号报错:[ts] 此处应为"="这里'vue'报错:[ts] 此处应为";"
纠错
修改tsconfig.json文件在compilerOptions中添加typeRoots
"compilerOptions": {
"typeRoots": [
"src/globalDeclare"
]
}然后将import type { DefineComponent } from 'vue'中的type删掉就行了,变成:import { DefineComponent } from 'vue'
解决!报错消失了!
转载自:https://segmentfault.com/a/1190000041600509