Skip to content

Observable does not implement InteropObservable #3890

Closed
@felixfbecker

Description

@felixfbecker

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSIssues and PRs related purely to TypeScript issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions