TypeScript 在 RxJS 定义中找不到名称 IPromise

TypeScript cannot find name IPromise in RxJS definition

我正在使用 typings 导入类型定义和 gulp-typescript 到 运行 TypeScript 编译器。当我 运行 我的 TypeScript 任务时,我收到一些关于 RxJS 类型中使用的 IPromiseIDisposable 类型的警告:

typings/main/ambient/rx/index.d.ts(34,20): error TS2304: Cannot find name 'IPromise'.
typings/main/ambient/rx/index.d.ts(36,29): error TS2304: Cannot find name 'IPromise'.
typings/main/ambient/rx/index.d.ts(49,36): error TS2304: Cannot find name 'IDisposable'.
typings/main/ambient/rx/index.d.ts(51,22): error TS2304: Cannot find name 'IPromise'.
typings/main/ambient/rx/index.d.ts(53,19): error TS2304: Cannot find name 'IPromise'.
typings/main/ambient/rx/index.d.ts(55,36): error TS2304: Cannot find name 'IPromise'.
typings/main/ambient/rx/index.d.ts(57,33): error TS2304: Cannot find name 'IPromise'.

我假设有另一个 RxJS 依赖的类型库,但是 none 在我安装定义时指定了。我用

添加了 RxJS 类型
typings install --save --ambient rx

安装文件开头的注释 rx/index.d.ts 说它适用于 RxJS v2.5.3,即使 RxJS 现在是版本 4。但是根据 typings search --ambient rx,该库在去年进行了更新,所以我假设它只是过时的评论。

我还需要什么其他的类型定义?有没有其他方法我可以找到它而不只是在这里问?

DefinitelyTyped 的 RxJS 类型定义似乎已经过时。相反,使用 npm 包提供的类型定义。

typings install --save --ambient npm:rx/ts/rx.all.d.ts

更新 对于打字 >= 1.0,请改用 --global

typings install --save --global npm:rx/ts/rx.all.d.ts