TypeScript @types问题
本文介绍了TypeScript @types问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
刚刚接触TypeScript,了解到lodash,按照文档配置后,
npm install --save @types/lodash
使用
import * as _ from "lodash";
打包的时候,提示Module not found: Error: Can't resolve 'lodash' in 'F:\web\TypeScript\src'
,
难道到底是什么问题,需要在node_modules里安装lodash?
解决方案
- 在
tsconfig.json
中去掉你的typeRoots
配置 - npm install lodash --save
- npm install @types/lodash --save-dev
这篇关于TypeScript @types问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文