Skip to content

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

Closed
Validark wants to merge 7 commits intoroblox-ts:masterfrom
Validark:patch-2
Closed

Update Promise.all/allSettled/race/some/any#138
Validark wants to merge 7 commits intoroblox-ts:masterfrom
Validark:patch-2

Conversation

@Validark
Copy link
Copy Markdown

@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
Copy Markdown
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