Class 'Subject<T>' incorrectly extends base class 'Observable<T>' with TypeScript 2.4
See original GitHub issueRxJS version: 5.4.1
Code to reproduce:
Save this line this to a TypeScript file (test.ts):
import {Subject} from 'rxjs/Subject';
Then compile:
tsc test.ts
Expected behavior: No errors
Actual behavior: Compilation error:
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 '<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'.
Additional information: TypeScript version: 2.4.1
TypeScript 2.4 introduced stricter checks for generics (see this blog post)
(Looks like this could be a typo in Observable#lift)
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
typescript - Class 'Subject<T>' incorrectly extends base ...
There are some issues with Microsoft/Typescript 2.4.1 update. From the discussion in this issues page, it seems you need to use.
Read more >[Solved]-Class 'Subject<T>' incorrectly extends base ...
Coding example for the question Class 'Subject ' incorrectly extends base class 'Observable ... in the compiler-options for typescript (tsconfig.json) set
Read more >Build Class Subject T incorrectly extends base class ...
Build Class Subject T incorrectly extends base class Observable T. We can solve the above issue in two ways. 1) By updating the...
Read more >Build:Class 'Derived' incorrectly extends base class 'BaseClass'
If I have a protected data member defined in a TypeScript BaseClass and a private member of the same name in Derived, it...
Read more >typescript error with Ionic 3 - JavaScript
Property 'apply' is missing in type 'NavOptions'. and. Typescript Error Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed by updating RxJS to 5.4.2
@dearfog TypeScript to 2.4.0