Error TS2415 Class ‘Subject’ incorrectly extends base class ‘Observable’.

After you setup angularjs 2 in your visual studio 2015, if you get this error:

 

Severity Code Description Project File Line Suppression StateSeverity Code Description Project File Line Suppression StateError TS2415 Class ‘Subject<T>’ incorrectly extends base class ‘Observable<T>’.  Types of property ‘lift’ are incompatible.    Type ‘<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’. TypeScript Virtual Projects C:\Users\xxxxxxx\Documents\Visual Studio 2015\Projects\Angular2Demo\Angular2Demo\node_modules\rxjs\Subject.d.ts 16 Active

 

All you have to do is:

Open this file:

tsconfig.json

and add the following line:

 

“noStrictGenericChecks”: true,

 

inside  “compilerOptions”: {

 

the entire file should look like:

 

{
“compilerOptions”: {
“noStrictGenericChecks”: true,
“target”: “es5”,
“module”: “commonjs”,
“moduleResolution”: “node”,
“sourceMap”: true,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“lib”: [ “es2015”, “dom” ],
“noImplicitAny”: true,
“suppressImplicitAnyIndexErrors”: true
}
}

Advertisements