Labeled variadic tuples should not require labeling spreads for tuples that are already labeled #52853
Closed
5 tasks done
Labels
Experience Enhancement
Noncontroversial enhancements
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
Suggestion
π Search Terms
variadic tuples name label element named labeled tuple elements
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Variadic tuples will inherit the labels of the tuples they're spreading
However, once a variadic tuple adds unlabeled elements, the variadic tuple loses the spread tuples' labels and compilation fails
As a workaround, we can label the spread, but this label never gets used. Even worse (and potentially a bug), this label's type is inferred as
any
Following up on #39941 (comment), a better DX might be to not require that
Tuple members must all have names
if the spread elements are already labeled, which would be consistent with the fact that variadic tuples already inherit the labels of their spreads.π Motivating Example
Playground link
π» Use Cases
Not having to redundantly label variadic tuple spreads
The text was updated successfully, but these errors were encountered: