Rxjs: Type inference lost after 10 operators inside an observable pipe

Created on 22 Jul 2020  路  4Comments  路  Source: ReactiveX/rxjs

Bug Report

Current Behavior

When creating a pipe of 10 operators, when you get to operator 10, you lose all type inference.

Reproduction

In this stackblitz, you can see there's no type error on the 10th line in the pipe.

This didn't always appear to be the case. Here's the exact same code, but using rxjs 6.2.0. It works as you would expect, you get an error on the line.

It looks 6.2.1 lost all type inference, and then 6.3.0 fixed it, but only for the first 9 operators.

Expected behavior

I would expect the 10th line to still have type inference.

Environment

  • Runtime: Node 12, Chrome 84.0.4147.89
  • RxJS version: 6.6.0

Additional context/Screenshots

It looks like it's explicitly defined this way, but obviously that's not ideal as it breaks all of our typescript if we have 10 pipe operators.

https://github.com/ReactiveX/rxjs/blob/master/src/internal/Observable.ts#L407

TS types

Most helpful comment

This is known limitation with current typescript compiler version rxjs supports and core team tracks roadmap to resolve it via ts 4.0's variadic tuple.

All 4 comments

This is known limitation with current typescript compiler version rxjs supports and core team tracks roadmap to resolve it via ts 4.0's variadic tuple.

hey, @kwonoj TS 4.0 is already in late beta so any idea when we can actually be able to see them in rxjs? As far as I know rxjs is quite a lot behind on TS version

Adaptong ts 4.0 with new feature means consumer of lib under 4.0 encounters breaking change.

now that TS 4.0 is out, Angular 10.1.0 is using it as well is there a chance that next big release will feature TS 4.0 support?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zzzen picture Zzzen  路  3Comments

Agraphie picture Agraphie  路  3Comments

unao picture unao  路  4Comments

haf picture haf  路  3Comments

dooreelko picture dooreelko  路  3Comments