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

问题

.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';
【已解决】Could not find a declaration file for module ‘xxx‘. vue + ts_第1张图片

解决方案

方案1:

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

方案2:

npm i --save-dev @types/lodash

你可能感兴趣的:(Vue,vue,typescript)