-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
TSIssues and PRs related purely to TypeScript issuesIssues and PRs related purely to TypeScript issues
Description
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
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 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
- REPL or Repo link:
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 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?
cartant, simeyla and jesses-canva
Metadata
Metadata
Assignees
Labels
TSIssues and PRs related purely to TypeScript issuesIssues and PRs related purely to TypeScript issues