不能导入react
来源:4-6 初次亮相 - 添加 normalize.css

光aaaaand影
2020-07-30
Could not find a declaration file for module ‘react’. ‘E:/project/learn/shinex/node_modules/react/index.js’ implicitly has an ‘any’ type.
老师,这是什么原因呢,难道要跳入react源码中吗
写回答
1回答
-
张轩
2020-07-31
同学你好 这个原因是比较明显的欧 就是没有 react 的定义文件,我们多次说过,如果使用 typescript,除了源代码,还需要有 @types 文件。你可以使用
npm install @types/react --save 来安装定义文件。
想问下你是怎样新建的项目,因为 create-react-app 的 ts 模版文件都是有类似的定义文件的。
022020-07-31
相似问题