-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Milestone
Description
π Search Terms
tuple spread any generic
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
π» Code
function join<T extends any[], P extends any[]>(): [...T, ...P] {
let x: any[] = [];
return x; // Target requires 2 element(s) but source may have fewer βββ
}
function join2<T extends any[], P extends any[]>(): [...T, ...P] {
let x: [any, any] = null!
return x; // Source provides no match for variadic element at position 0 in target β
}π Actual behavior
join errors on return with Target requires 2 element. There is nothing in the target type that suggests it requires two elements.
π Expected behavior
Should error with a message similar to join2:
Source provides no match for variadic element at position 0 in target
Additional information about the issue
No response
rotu