I found a sample template code in this helpful tutorial and followed these two steps to get started -
npm install // everything went smoothly, created node_modules folder with all dependencies
npm start
// encountered an error as shown below-node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'. Types of property 'lift' are incompatible. Type '<T, R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'. Type 'Observable<T>' is not assignable to type 'Observable<R>'. Type 'T' is not assignable to type 'R'. npm ERR! code ELIFECYCLE npm ERR! errno 2
I noticed that the lift method declaration in subject.d.ts is like this -
lift<T, R>(operator: Operator<T, R>): Observable<T>;
However, in Observable.ts it is defined differently-
lift<R>(operator: Operator<T, R>): Observable<R> {
Note:- 1. I am still exploring Angular2 and trying to understand how things work.
The error may be due to conflicting definitions of the lift method
I referred to this conversation on GitHub for more insights
If switching to a different version of rxjs could solve the issue, please guide me on how to uninstall the current one and install the correct rxjs version.
Edit1: I may be late in responding, but the same error persists even after trying typescript 2.3.4 or rxjs 6 alpha. Here's my package.json file for reference,
{
"name": "angular-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "6.0.0-alpha.0",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "2.3.4",
"typings": "^1.3.2"
}
}