解决引入lodash库(或其他第三方库)时TS报错:TS7016: Could not find a declaration file for 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'

谁报错就增加谁

猜你喜欢

转载自blog.csdn.net/xjtarzan/article/details/132433454
今日推荐