You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Key for rest Tuple argument missing when mapping tuple typeΒ #57770
typeGetTupleKeys<Tupleextendsunknown[]>={[KinkeyofTuple]: K}[keyofTuple];// In 5.4.2 we get `number | "0"`// In 5.3.3 we get `number | "0" | "1"`{typetest=GetTupleKeys<[string, ...number[]]>}// ^?// In 5.4.2 we get `"0" | 2 | "1"` (which is equivalent anyways)// In 5.3.3 we get `"0" | "1" | 2`{typetest=GetTupleKeys<[string,number]>}// ^?
π Actual behavior
In 5.4.2, rest arguments in tuples no longer get a dedicated key/index when mapping the tuple type. In the above example, the tuple type [string, ...number[]] effectively produces the keys number | "0"
π Expected behavior
No regression. The above example should be as 5.3.3 and resolve to the keys number | "0" | "1"
Activity
Andarist commentedon Mar 14, 2024
It works as intended as per the change in #57031
typescript-bot commentedon Mar 18, 2024
This issue has been marked as "Not a Defect" and has seen no recent activity. It has been automatically closed for house-keeping purposes.