Closed
Description
TypeScript Version: 3.2.4
Search Terms:
Tuple, merge, combine
Code
function combine<T, U extends any[]>(item: T, items: U): [T, ...U] {
return [] as any;
}
const result = combine("hello", ["goodbye", 123, true]);
Expected behavior:
result should be typed as [string, string, number, boolean]
.
Actual behavior:
Compile error:
A rest element type must be an array type.
Playground Link:
Link
Related Issues:
Metadata
Metadata
Assignees
Labels
No labels