【已解决】Could not find a declaration file for module ‘xxx‘. vue + ts

Mezereon

关注

阅读 94

2022-03-12

问题

.ts 文件中引入三方模块报错.
Could not find a declaration file for module 'lodash'. 'xxx/node_modules/lodash/lodash.js' implicitly has an 'any' type. Try 'npm i --save-dev @types/lodash' if it exists or add a new declaration (.d.ts) file containing declare module 'lodash';
在这里插入图片描述

解决方案

方案1:

shims-vue.d.ts 文件中加入代码 declare module 'lodashe'

方案2:

npm i --save-dev @types/lodash

精彩评论(0)

0 0 举报