使用TS开发前端项目时,如果在引入第三方文件时报错,例如引入 lodash 库时TS报错:
TS7016: Could not find a declaration file for module lodash
可以在 src 目录下的 “shims-vue.d.ts” 文件里增加如下代码
declare module '*.js'
declare module 'lodash'
谁报错就增加谁
使用TS开发前端项目时,如果在引入第三方文件时报错,例如引入 lodash 库时TS报错:
TS7016: Could not find a declaration file for module lodash
可以在 src 目录下的 “shims-vue.d.ts” 文件里增加如下代码
declare module '*.js'
declare module 'lodash'
谁报错就增加谁