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 Promise.all/allSettled/race/some/any #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Validark
Copy link

@Validark Validark commented Aug 8, 2022

  • all no longer accepts non-promises in the input array
  • allSettled now preserves array/tuple length where possible
  • some can take in a positive, non-decimal numeric literal type and convert it to a tuple of the right length.
  • 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)[]>

As opposed to #138, this PR does not publicly expose BuildTuple.

- `all` no longer accepts non-promises in the input array
- `allSettled` now preserves array/tuple length where possible
- `some` can take in a positive, non-decimal numeric literal type and convert it to a tuple of the right length.
- `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)[]>`
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