Skip to content

Why different generics for Subscriber and Observable #2166

@donaldpipowitch

Description

@donaldpipowitch

Not sure if this is a bug or not.

RxJS version:

5.0.0-rc.4

Code to reproduce:

static create: Function = <T>(subscribe?: <R>(subscriber: Subscriber<R>) => TeardownLogic) => {

Expected behavior:

  static create: Function = <T>(subscribe?: <T>(subscriber: Subscriber<T>) => TeardownLogic) => {
    return new Observable<T>(subscribe);
  };

Actual behavior:

  static create: Function = <T>(subscribe?: <R>(subscriber: Subscriber<R>) => TeardownLogic) => {
    return new Observable<T>(subscribe);
  };

Additional information:

Maybe I misunderstood this part of RxJS, but I thought the Observable and Subscriber would share the same generic type here? Aren't the values I pass to subscriber.next from the same type I get when I use value$.map?

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