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

Update Promise.all/allSettled/race/some/any #138

Closed
wants to merge 7 commits into from

Conversation

Validark
Copy link

@Validark Validark commented Aug 2, 2022

  • all no longer accepts non-promises in the input array
  • allSettled now preserves array/tuple length where possible

all/allSettled/race/some/any now all:

  • accept readonly arrays, since these methods don't mutate in-place
  • accept arrays with different Promise types in them, e.g. [Promise<number>, Promise<string>] now works

for race/any, we transform [Promise<number>, Promise<string>] into Promise<number | string> rather than Promise<number> | Promise<string>. For some it is the same but an array: Promise<(number | string)[]>

- `all` no longer accepts non-promises in the input array
- `allSettled` now preserves array/tuple length where possible

`all`/`allSettled`/`race`/`some`/`any` now all:
- accept readonly arrays, since these methods don't mutate in-place
- accept arrays with different Promise types in them, e.g. `[Promise<number>, Promise<string>]` now works

for `race`/`any`, we transform `[Promise<number>, Promise<string>]` into `Promise<number | string>` rather than `Promise<number> | Promise<string>`. For `some` it is the same but an array: `Promise<(number | string)[]>`
@Validark
Copy link
Author

Validark commented Aug 8, 2022

Closed in favor of #140

@Validark Validark closed this Aug 8, 2022
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.

1 participant