rxjs
rxjs copied to clipboard
fix(interop): allow Rx Observable to be consumed as InteropObservable at type level
Description:
This fixes the interop story for other libraries that would like to consume Rx as interop observable. This weird, weird structure ensures that the Symbol.observable type is emitted correctly to the .d.ts file - it's actually not emitted directly but this computed property is left in the class declaration and its type is Symbol.observable, so the whole thing works.
I got a hint that this might work from this comment in the TS repo - since it has mentioned "dotted names". So I've figured out that it's worth a try here and, somewhat, surprisingly I've managed to get this working.
Related issue (if exists): fixes #6777
Sorry I'm just getting to reviewing this. This is a big deal if things work. However we need to support TS 4.2 (not necessarily fixing this issue for 4.2, we just can't break compilation for users of 4.2) otherwise this has to land in 8.x
@benlesh as far as I know - this doesn't break anything for TS 4.2 consumers. It just doesn't fix that issue for them. The @ts-ignore comment looks suspicious but it's actually what makes it "safe" for TS 4.2. I could do further testing with this PR if you want.