Inferred subtuple types in extends
expression not narrowed if variadic (i.e. has a rest element)
#51138
Labels
Milestone
Bug Report
Given the following behavior, which correctly narrows a subtuple:
One would expect similar narrowing when a tuple involves a rest element, but no narrowing occurs:
Fixing this bug would be useful as a non-recursive method of grabbing a subtuple of a predefined length, while also maintaining the subtuple's labels—which I think cannot be done today.
🔎 Search Terms
narrowing, tuple, extend, variadic
🕗 Version & Regression Information
Typescript
4.7
,4.8
, and4.9.0-dev.20221004
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
🙂 Expected behavior
[a: 0, b: 1]
The text was updated successfully, but these errors were encountered: