likes
comments
collection
share

vue3+ts项目的shims.d.ts文件报错

作者站长头像
站长
· 阅读数 65

问题点

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
评论
请登录