Closed as not planned
Description
Bug Report
π Search Terms
- overload
- spread
β― Playground Link
Playground link with relevant code
π» Code
type A = [number, number]
type B = [string, string]
type AB = A | B
function foo(...args:A): void /* works when removed */
function foo(...args:B): void /* works when removed */
function foo(...args:AB){}
const args = [1, 2] as AB
foo(...args)
// A spread argument must either have a tuple type or be passed to a rest parameter.(2556)
π Actual behavior
Type Error:
A spread argument must either have a tuple type or be passed to a rest parameter.(2556)
π Expected behavior
No type errors. All resolutions of the AB
union are valid tuples and should be spreadable.