Typescript: 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'.

Created on 9 Jul 2019  路  4Comments  路  Source: microsoft/TypeScript


TypeScript Version: 3.4.0-dev.201xxxxx


Search Terms:

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

Unactionable

Most helpful comment

Why would a function that returns Observable<T> be assignable to one that returns Observable<R>? They are different type parameters. Structural typing doesn't apply to generics because the compiler doesn't know which type(s) will be used.

All 4 comments

If you want to provide details about the issues you have upgrading, you can do so. But ranting that "everything is broken" is not really productive or actionable.

Most people are dealing with this issue. It has been there for quite sometime, rxjs^5.2.1 worked well with typescript 2.4 but since typescript upgraded in IDEs. It no longer works. Worse Ionic! To be honest I was starting to like typescript then this.

Why would a function that returns Observable<T> be assignable to one that returns Observable<R>? They are different type parameters. Structural typing doesn't apply to generics because the compiler doesn't know which type(s) will be used.

Without some way to reproduce the issue or even see it, we're not going to be able to make any progress here. Please log a new issue with all the fields in the template filled in if appropriate.

Was this page helpful?
0 / 5 - 0 ratings