Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exhaust causes type issues #2658

Closed
krasi opened this issue Jun 13, 2017 · 4 comments
Closed

Exhaust causes type issues #2658

krasi opened this issue Jun 13, 2017 · 4 comments
Labels
TS Issues and PRs related purely to TypeScript issues

Comments

@krasi
Copy link

krasi commented Jun 13, 2017

RxJS version: 5.0.1

Code to reproduce:
.exhaust()

Expected behavior:
Flattens an Observable-of-Observables by dropping the next inner Observables
while the current inner is still executing.

Actual behavior:
Does not flatten the Observable.

Additional information:
There was a change in this commit
7b23e88,
which updates the type of exhaust from SwitchFirstSignature to typeof exhaust.
The first one is of type Generic, while the other one's type is Observable.
This will cause Typescript issues such as "error TS2322: Type 'Observable' is not assignable to type..."

@krasi krasi changed the title Exhaust returns type issues Exhaust causes type issues Jun 13, 2017
@kwonoj
Copy link
Member

kwonoj commented Jun 13, 2017

I can't look for signature change in given commits - would you provide small snippet can reproduce issue?

@kwonoj kwonoj added TS Issues and PRs related purely to TypeScript issues status: more information needed labels Jun 13, 2017
@krasi
Copy link
Author

krasi commented Jun 15, 2017

Hello,

Here is a code written in TypeScript 2.3.4, which reproduces the issue:

ngOnInit() {
  let c: number;
  this.source_one()
    .map( (val) => {
      return this.source_two(val);
    })
    .exhaust()
    .subscribe((result) => {
      c = result; // error TS2322: Type 'Observable<any>' is not assignable to type 'number'.
    });
}

source_one(): Observable<any> {
  let a: number = 42;
  return Observable.create((observer) => {
    observer.next(a);
    return () => {};
  });
}

source_two(val): Observable<any> {
  let b: number = 35;
  return Observable.create((observer) => {
    observer.next(val + b);
    return () => {};
  });
}

david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 22, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how` hot and cold observables are typed.  A few compiler errors were fixed ddue to this change

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 22, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 22, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 22, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 22, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit to david-driscoll/RxJS-1 that referenced this issue Jun 23, 2017
fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes ReactiveX#2658 ReactiveX#2493 ReactiveX#2551
david-driscoll added a commit that referenced this issue Jun 27, 2017
…2690)

fixes concatAll, combineAll, exhaust, mergeAll, switch, zipAll.  Also made a few improvements to
how hot and cold observables are typed.  A few compiler errors were fixed due to this change.

fixes #2658 #2493 #2551
@kwonoj
Copy link
Member

kwonoj commented Jul 12, 2017

I think this one's fixed via #2690.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
TS Issues and PRs related purely to TypeScript issues
Projects
None yet
Development

No branches or pull requests

2 participants