From 36549572aad8d4e3ceaff5e2ae7c79421f37021e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 23 Oct 2015 13:33:55 -0700 Subject: [PATCH] Add tests and accept baselines --- .../reference/unionTypeCallSignatures.errors.txt | 8 +++++++- tests/baselines/reference/unionTypeCallSignatures.js | 6 ++++++ .../conformance/types/union/unionTypeCallSignatures.ts | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index ebe38a589ee..bf1de6ff8e8 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -28,9 +28,10 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(67,12): error TS2 tests/cases/conformance/types/union/unionTypeCallSignatures.ts(68,12): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,12): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (30 errors) ==== +==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (31 errors) ==== var numOrDate: number | Date; var strOrBoolean: string | boolean; var strOrNum: string | number; @@ -162,4 +163,9 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2 ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. + var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; + strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + strOrNum = unionWithRestParameter4("hello", "world"); \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeCallSignatures.js b/tests/baselines/reference/unionTypeCallSignatures.js index fc3dfc8ebbc..103d92fbef3 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.js +++ b/tests/baselines/reference/unionTypeCallSignatures.js @@ -70,6 +70,9 @@ strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter3(); // error no call signature +var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; +strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature +strOrNum = unionWithRestParameter4("hello", "world"); //// [unionTypeCallSignatures.js] @@ -132,3 +135,6 @@ strOrNum = unionWithRestParameter3('hello', 10); // error no call signature strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter3(); // error no call signature +var unionWithRestParameter4; +strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature +strOrNum = unionWithRestParameter4("hello", "world"); diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts index ca599329743..a25d27d9a29 100644 --- a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts @@ -69,3 +69,6 @@ strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter3(); // error no call signature +var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; +strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature +strOrNum = unionWithRestParameter4("hello", "world");