当前位置 : 主页 > 网页制作 > React >

typescript – dt~ react-router error TS2503:找不到命名空间’HistoryModule’

来源:互联网 收集:自由互联 发布时间:2021-06-15
我尝试使用typings install –save –global dt~ react-router下载React-Router输入法定义,但我的代码仍然无法编译,因为typings / globals / react-router / index.d.ts引用的HistoryModule不存在. 早些时候我被推荐使
我尝试使用typings install –save –global dt~ react-router下载React-Router输入法定义,但我的代码仍然无法编译,因为typings / globals / react-router / index.d.ts引用的HistoryModule不存在.

早些时候我被推荐使用打字–save react-router,但是虽然这包括可怕的“HistoryModule”,但它缺少React Router元素通常具有的属性的其他键输入定义(缺少Route元素道具的onChange属性) .我需要下载其他类似的东西以使其工作吗?另外,我如何判断是否需要下载多个其他全局类型定义以使另一个定义工作,因为我不知道任何方式并且如果全局类型定义依赖于其他类型,则typings命令似乎无法理解模块.

从 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. This is because references are not an adequate dependency system.
07001
typings install dt~react-router/history --global

网友评论