Skip to content

Conversation

@dubzzz
Copy link

Currently Promise.all does not seem to properly type tuples containing more than 10 elements. For instance the following snippet is failing in TypeScript 3.9 (except if the user specifies Promise.all<string|number>, but the typings would be wrong in that case):

consta=Promise.all([Promise.resolve(1),Promise.resolve('string'),Promise.resolve(1),Promise.resolve('string'),Promise.resolve(1),Promise.resolve('string'),Promise.resolve(1),Promise.resolve('string'),Promise.resolve(1),Promise.resolve('string'),Promise.resolve(1),Promise.resolve('string'),])// fails to compile with TS 3.9 see playground link below

This PR suggests a way to properly type tuples containing more than 10 items.

See it in action https://www.typescriptlang.org/play/index.html#code/CYUwxgNghgTiAEkoGdnwLIE8AKMD2AtgJbIIDeAUPNfMgC5R1FjxQQQA8AKmiAB50QAO2Bo4UYHiERM8ANpQhmALrwAPvHGTpsxZjnKAfAAoAbmwCuIZAC54PAJR3chEiA5l5AaXhEh8AGsQTDwAM3tkZTseOS9VfkERNBdiUgAZIiCOP1CQGHgAVUN4AH5C+GjkWNUAX0MKGooKMCl6VngAXgwcfFSQADo2CGM5FLd+uGQ8CFMQYwBGBwAaeDHSCetp2eMAcnoYPwBzHYdlB2bWungAI07utYGhkfmVh42pmbm9ugOhY9Pzi0hG0WF0sG8nnIXvBvr9jmcLsCrsA7uDeuNIaoUKt0aQOEILARrnlDAZAZd4AgwT1XOtMaw0ASiXkyYi2uFqRD2CM3pMtnNFq9cQM+Z9dvsjiclrzNmLBTjaSLZdtYZLljKPtt5Rr+eKfmrpcL3rrtUbRSqJX8pTq5csFX1jWLVVb1WblQK7TaLfqXQimkC2lAHgBBdh3LnDUZuzUeoWKx3euEnBEBq7XENhroR55xh3mr6W-4pilgDMQcNGyHQ53w8lI+DAMsV+P07EPfGE4kwUnF+sgJtZyvcgwM+BMrus1PwUID+0Y4de2Nz9b5vVJ13x1emzfutcGxcLT3R3U163H2258ar08bvO77d3mN7l2GndPh9X3c3hFAA

Fixes#22469

@RyanCavanaugh, it is a follow up for my PR on Promise.race#27192 and #31117

@dubzzzdubzzz closed this Jul 4, 2020
@microsoftmicrosoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto 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.

Suggestion: Allow array of > 10 values in argument of Promise.all() and Promise.race()

1 participant

@dubzzz