Bug Report
Current Behavior
I am trying to write a library interface that accepts InteropObservable for two reasons:
- to allow any Observable implementation to be passed
- I don't want to use
Observable as an input type, because it is a class, and TypeScript will therefor reject passing in an instance of RxJS Observable if it is an instance of Observable from a different file (different package version, or duplicate because of npm link). Coding against interfaces is better than coding against implementations
I get the error:
Type 'Observable<T>' is not assignable to type 'InteropObservable<T>'.
Property '[Symbol.observable]' is missing in type 'Observable<T>'.
Reproduction
Expected behavior
I would expect to be able to have my interface accept InteropObservable, and pass in an RxJS concrete Observable without a compile error.
Environment
- Runtime: any
- RxJS version: 6.2.1
Possible Solution
Add symbol.observable to Observable, and make it implement InteropObservable?
Bug Report
Current Behavior
I am trying to write a library interface that accepts
InteropObservablefor two reasons:Observableas an input type, because it is a class, and TypeScript will therefor reject passing in an instance of RxJSObservableif it is an instance ofObservablefrom a different file (different package version, or duplicate because ofnpm link). Coding against interfaces is better than coding against implementationsI get the error:
Reproduction
https://stackblitz.com/edit/typescript-3v2qer
Expected behavior
I would expect to be able to have my interface accept
InteropObservable, and pass in an RxJS concreteObservablewithout a compile error.Environment
Possible Solution
Add
symbol.observabletoObservable, and make itimplement InteropObservable?