Skip to content

chore(typings): improve zip typings#2860

Closed
cartant wants to merge 1 commit intoReactiveX:masterfrom
cartant:issue-2784-zip-2
Closed

chore(typings): improve zip typings#2860
cartant wants to merge 1 commit intoReactiveX:masterfrom
cartant:issue-2784-zip-2

Conversation

@cartant
Copy link
Copy Markdown
Collaborator

@cartant cartant commented Sep 25, 2017

Add signature to the lettable zipProto so it's consistent with the
non-lettable zipProto.

Description:

This PR is closely related to #2787. In between that PR being submitted and its being merged there were WIP commits made re: lettable operators. Consequently, the overload signature that the PR added to the non-lettable zipProto was not included in the lettable zipProto.

This PR adds the relevant overload to the lettable zipProto.

Related issue (if exists): #2784

Add signature to the lettable zipProto so it's consistent with the
non-lettable zipProto.
@cartant
Copy link
Copy Markdown
Collaborator Author

cartant commented Sep 25, 2017

Unfortunately, this PR falls victim to TypeScript matching arbitrary functions with ArrayLike<any> and, consequently, with ObservableInput<any>. That means that if T is any there is no sensible order for:

export function zip<T>(...observables: Array<ObservableInput<T>>): OperatorFunction<T, T[]>;

and:

export function zip<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R)>): OperatorFunction<T, R>;

When T is any whichever is first will be matched regardless of whether or not a projection function is specified.

This is a pity, as when T is not any it works fine. Such is life.

This also means that the signature added in PR #2787 is also unsafe when T is any and should probably be removed.

@lock
Copy link
Copy Markdown

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 Jun 6, 2018
@cartant cartant deleted the issue-2784-zip-2 branch September 24, 2020 07:06
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.

1 participant