You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With typescript 2.4.1, I get a compile error when trying to use rxjs 5.4.1 in my trivial angular 4 cli app during the webpack step. When I revert to typescript 2.3.3 using the same rxjs version, there is no error and rxjs features seem to work as expected.
ERROR in myapppath/node_modules/rxjs/Subject.d.ts (16,22): 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'. webpack: Failed to compile.
When I look at Observable.d.ts and Subject.d.ts, I see that it's true that the lift method is returning different types, even though Subject extends Observable here:
In Subject.d.ts: lift<R>(operator: Operator<T, R>): Observable<T>;
In Observable.d.ts: lift<R>(operator: Operator<T, R>): Observable<R>;
With typescript 2.4.1, I get a compile error when trying to use rxjs 5.4.1 in my trivial angular 4 cli app during the webpack step. When I revert to typescript 2.3.3 using the same rxjs version, there is no error and rxjs features seem to work as expected.
ERROR in myapppath/node_modules/rxjs/Subject.d.ts (16,22): 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'. webpack: Failed to compile.
When I look at Observable.d.ts and Subject.d.ts, I see that it's true that the lift method is returning different types, even though Subject extends Observable here:
In Subject.d.ts:
lift<R>(operator: Operator<T, R>): Observable<T>;
In Observable.d.ts:
lift<R>(operator: Operator<T, R>): Observable<R>;
This blog post suggests stricter generic type checking on functions in 2.4, so I'm guessing the Subject.d.ts method sig might be a typo that was not noticed.
https://blogs.msdn.microsoft.com/typescript/2017/06/27/announcing-typescript-2-4/
RxJS version: 5.4.1
Code to reproduce:
Expected behavior:
Actual behavior:
Additional information:
The text was updated successfully, but these errors were encountered: