[英]TypeScript is using different versions of @types for react
I have set my compilerOptions
in tsconfig.json
with the following paths
我已经把我的
compilerOptions
在tsconfig.json
具有以下paths
"paths": {
"react": ["node_modules/@types/react"],
"@types/react": ["node_modules/@types/react"]
}
Yet, I can see that @types/react-router
is using it's own version of @types/react
and this is causing compilation error, things like: 但是,我可以看到
@types/react-router
正在使用它自己的@types/react
版本,这会导致编译错误,例如:
ERROR in /path/to/node_modules/@types/react-router/node_modules/@types/react/index.d.ts
ERROR in /path/to/node_modules/@types/react-router/node_modules/@types/react/index.d.ts(2297,27)
TS1005: ';' expected.
How do I force all modules to use the version of the @types I want to include? 如何强制所有模块使用要包含的@types版本?
npm install @types/yourModule --save-dev
can you try it 你可以试试看吗
dont touch the tsconfig.json file 不要触摸tsconfig.json文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.