Shaun Shaun - 1 year ago 345
TypeScript Question

TypeScript cannot find name IPromise in RxJS definition

I'm using

to import type definitions and
to run the TypeScript compiler. When I run my TypeScript task, I get a few warnings about the
types used in the RxJS typings:

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'.

I'm assuming there is another typings library that RxJS depends on, but none was specified when I installed the definition. I added the RxJS typings with

typings install --save --ambient rx

The comment at the beginning of the installed file,
, says it's for RxJS v2.5.3, even though RxJS is up to version 4 now. But the library was updated last year, according to the
typings search --ambient rx
, so I'm assuming it's just that comment that is outdated.

What other type definition do I need and is there some other way I could have found it than to just ask here?

Answer Source

The RxJS type definition from DefinitelyTyped does appear to be outdated. Instead, use the type definition provided by the npm package.

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

Update For typings >= 1.0, use --global instead.

typings install --save --global npm:rx/ts/rx.all.d.ts
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download