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

Bring all() types closer to Promise.all() #873

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Bring all() types closer to Promise.all() #873

merged 2 commits into from
Jan 2, 2024

Conversation

cowboyd
Copy link
Member

@cowboyd cowboyd commented Dec 29, 2023

Motivation

#870

Non-goals

  1. It does not need to support non-operation types like primitives, null, or undefined; unlike Promise.all() which can receive non-Promise values.
  2. Does not (currently) need to support iterables. This will come later.

Approach

I used the typings for Promise.all() as a basis for the typings for all(). The only thing missing was that we needed an equivalent to the Awaited type, so this includes a Yielded<T> type which can be used to unwrap the type of an Operation. For example:

Yielded<Operation<string>> // => string
Yielded<Operation<number>> // => number

The Yielded type is not exported, but probably should be at some point.

@cowboyd cowboyd changed the title Add test case for all() types Make all() types equivalent to Promise.all() Dec 29, 2023
@cowboyd cowboyd changed the title Make all() types equivalent to Promise.all() Bring all() types closer to Promise.all() Dec 30, 2023
@cowboyd cowboyd requested a review from neurosnap December 30, 2023 15:06
@cowboyd cowboyd marked this pull request as ready for review December 30, 2023 15:06

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@cowboyd cowboyd merged commit 66a0f0c into v3 Jan 2, 2024
@cowboyd cowboyd deleted the types-for-all branch January 2, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants