[英]dt~react-router error TS2503: Cannot find namespace 'HistoryModule'
I tried to download the React-Router typings definition using typings install --save --global dt~react-router
, but my code will still not compile because the HistoryModule referenced by typings/globals/react-router/index.d.ts does not exist. 我尝试使用
typings install --save --global dt~react-router
下载React-Router输入法定义,但我的代码仍然无法编译,因为typings / globals / react-router / index.d.ts引用的HistoryModule不存在。
Earlier I was recommended to go with typings --save react-router
, but although this includes the dreaded "HistoryModule", it is missing other key typing definitions for properties which the React Router elements typically have (missing onChange property of Route element props). 早些时候我被推荐使用
typings --save react-router
,但是虽然这包括可怕的“HistoryModule”,但它缺少React Router元素通常具有的属性的其他键输入定义(缺少Route元素道具的onChange属性) 。 Is there something else from typings that I need to download to get this to work? 我需要下载其他类似的东西以使其工作吗? Also, how can I tell if I need to download multiple other global typings definitions to get a different one to work, because I'm not aware of any way and the typings command does not appear to understand if a global typing definition depends on other modules.
另外,我如何判断是否需要下载多个其他全局类型定义以使另一个定义工作,因为我不知道任何方式并且如果全局类型定义依赖于其他类型,则typings命令似乎无法理解模块。
from https://github.com/DefinitelyTyped/DefinitelyTyped/issues/9928 来自https://github.com/DefinitelyTyped/DefinitelyTyped/issues/9928
The CLI tells you that there's been references stripped, it is up to the user to make sure they get installed.
CLI告诉您已经剥离了引用,由用户确保它们已安装。 This is because references are not an adequate dependency system.
这是因为引用不是一个适当的依赖系统。
![]()
typings install dt~react-router/history --global
Is there something else from typings that I need to download to get this to work
我需要下载其他类似的东西以使其工作
There is a bug in the typings compiler for this. 打字编译器中有一个错误。 Its buggy in TypeScript
@types
system as well (issue https://github.com/Microsoft/TypeScript/issues/9488 ) 它在TypeScript
@types
系统中也有问题(问题https://github.com/Microsoft/TypeScript/issues/9488 )
I would just copy the react-router
file + history
file from DT manually (that's what I did at work too) 我会手动从DT复制
react-router
文件+ history
文件(这也是我在工作中所做的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.