简体   繁体   English

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

[英]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.

相关问题 错误TS2503:找不到我的名称空间 - error TS2503: Cannot find my namespace 错误 TS2503:找不到命名空间“WebMidi” - error TS2503: Cannot find namespace 'WebMidi' 打字稿错误:app.ts(18,10):错误TS2503:找不到命名空间'server' - Typescript error: app.ts(18,10): error TS2503: Cannot find namespace 'server' Ionic2 + Firebase应用程序编译错误:TypeScript错误:错误TS2503:找不到名称空间“ firebase” - Ionic2+Firebase app compile error: TypeScript error:Error TS2503: Cannot find namespace 'firebase' 在模块内部使用模块进行类型声明无法编译(TS2503无法找到名称空间) - using module inside a module for type declaration doesn't compile (TS2503 cannot find namespace) Angular:无法使用 ExcelJS 导出 excel - 错误 TS2307:找不到模块“流” - 错误 TS2503:找不到命名空间“NodeJS” - Angular : Can't export excel using ExcelJS - error TS2307: Cannot find module 'stream' - error TS2503: Cannot find namespace 'NodeJS' axios 错误命名空间“axios”未找到 ts(2503) - axios error Namespace 'axios' not found ts(2503) 在 node_modules 的 react-router 文件夹中找不到 'LeftSegment' & 找不到 'infer' 错误 - Cannot find 'LeftSegment' & Cannot find 'infer' error in react-router folder in node_modules 尝试使用导入的字符串常量来约束打字稿类型文字时,获取TS2503 - Getting s TS2503 when trying to use an imported string constant to constrain a typescript type literal Typescript 2种带有react-router的类型,找不到名称路径,组件 - Typescript 2 types with react-router, cannot find name path, component
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM