I have a problem trying to use RxJS with TypeScript and Node.js. I am using NPM, and I have included rxjs-es version 5. I am also using Typings, and I have included both es6-shim and rx.all, like so:
{
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"rx.all": "registry:dt/rx.all#2.2.28+20160316155526"
}
}
Below is my tsconfig.json file.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/browser",
"typings/browser.d.ts"
]
}
In a TypeScript file, I am trying to do the following:
import { Observable } from 'rxjs/Observable';
When I try to compile the script, I get the following error:
typings/main/ambient/rx.all/index.d.ts(10,11): error TS2304: Cannot find name 'Rx'.
This happens even if I try to use RxJS within my script or not, so the problem is related to the TypeScript typings.
What do I need to install using typings and NPM in order to use RxJS? In particular, I am interested in using Observables. After Googling for hours, I cannot seem to figure out just what I need to make it work. I have tried the following, but without any luck. I have also tried many combinations of rx packages in NPM and typings, but haven't found anything that works. Any help is much appreciated!
import { Observable } from 'rxjs/Rx'should just work.