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

Sha*_*aun 10 rxjs typescript

我正在使用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'.
Run Code Online (Sandbox Code Playgroud)

我假设有一个RxJS依赖的另一个打字库,但是当我安装定义时没有指定.我添加了RxJS类型

typings install --save --ambient rx
Run Code Online (Sandbox Code Playgroud)

安装文件开头的注释rx/index.d.ts表示它适用于RxJS v2.5.3,即使RxJS现在已达到版本4.但据该报道,图书馆去年更新了typings search --ambient rx,所以我假设这只是过时的评论.

我需要什么样的其他类型定义,还有其他一些方法可以找到它而不仅仅是问这里吗?

Sha*_*aun 16

DefinitelyTyped中的RxJS类型定义似乎已过时.而是使用npm包提供的类型定义.

typings install --save --ambient npm:rx/ts/rx.all.d.ts
Run Code Online (Sandbox Code Playgroud)

更新对于typings> = 1.0,请--global改用.

typings install --save --global npm:rx/ts/rx.all.d.ts
Run Code Online (Sandbox Code Playgroud)