TypeScript/tests/cases/conformance/types/union/unionTypeCallSignatures4.ts
Wesley Wigham 96937fd592
Allow union signatures to merge when they have differing argument counts (#28604)
* Allow union signatures to merge when they have differing argument counts

* Accept updated baselines

* Adjust comments io changed tests
2018-11-19 17:05:28 -08:00

25 lines
615 B
TypeScript

type F1 = (a: string, b?: string) => void;
type F2 = (a: string, b?: string, c?: string) => void;
type F3 = (a: string, ...rest: string[]) => void;
type F4 = (a: string, b?: string, ...rest: string[]) => void;
type F5 = (a: string, b: string) => void;
var f12: F1 | F2;
f12("a");
f12("a", "b");
f12("a", "b", "c"); // ok
var f34: F3 | F4;
f34("a");
f34("a", "b");
f34("a", "b", "c");
var f1234: F1 | F2 | F3 | F4;
f1234("a");
f1234("a", "b");
f1234("a", "b", "c"); // ok
var f12345: F1 | F2 | F3 | F4 | F5;
f12345("a"); // error
f12345("a", "b");
f12345("a", "b", "c"); // error