Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript cannot find name IPromise in RxJS definition

I'm using typings to import type definitions and gulp-typescript to run the TypeScript compiler. When I run my TypeScript task, I get a few warnings about the IPromise and IDisposable 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, rx/index.d.ts, 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?

like image 206
Shaun Avatar asked Mar 10 '16 14:03

Shaun


1 Answers

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
like image 54
Shaun Avatar answered Sep 19 '22 11:09

Shaun