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

fix(typescript): Update typings for race to support proper return types #4465

Merged
merged 2 commits into from
Jan 14, 2019

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Jan 11, 2019

The types returned by race were incorrect. This ought to resolve that.

@benlesh benlesh requested a review from cartant January 11, 2019 18:12
export function race<A, B, C, D>(a: Observable<A>, b: Observable<B>, c: Observable<C>, d: Observable<D>): Observable<A> | Observable<B> | Observable<C> | Observable<D>;
export function race<A, B, C, D, E>(a: Observable<A>, b: Observable<B>, c: Observable<C>, d: Observable<D>, e: Observable<E>): Observable<A> | Observable<B> | Observable<C> | Observable<D> | Observable<E>;
// tslint:enable:max-line-length

export function race<T>(observables: Array<Observable<T>>): Observable<T>;
export function race<T>(observables: Array<Observable<any>>): Observable<T>;
export function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): Observable<T>;
Copy link
Collaborator

@cartant cartant Jan 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why

export function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): Observable<T>;

needs to be an overload signature. I can see why it is the implementation signature, but why it needs to be an overload baffles me. Don't the others handle the scenarios that are bundled into this signature?

Do we really need to keep this already-existing signature? Can it be removed?

LGTM, otherwise.

@coveralls
Copy link

coveralls commented Jan 11, 2019

Pull Request Test Coverage Report for Build 7888

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.966%

Totals Coverage Status
Change from base Build 7883: 0.0%
Covered Lines: 5784
Relevant Lines: 5965

💛 - Coveralls

Copy link
Collaborator

@cartant cartant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benlesh benlesh merged commit 0042846 into ReactiveX:master Jan 14, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants