question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class 'Subject<T>' incorrectly extends base class 'Observable<T>' with TypeScript 2.4

See original GitHub issue

RxJS 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:closed
  • Created 6 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
Argon2000commented, Aug 8, 2017

Fixed by updating RxJS to 5.4.2

3reactions
am0wacommented, Aug 14, 2017

@dearfog TypeScript to 2.4.0

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found