From f6454326ddb7760bf69574d77b495ba801fb1611 Mon Sep 17 00:00:00 2001 From: erictsangx Date: Tue, 8 Dec 2015 17:47:40 +0800 Subject: [PATCH 1/4] Fix issue: Confusing error message when calling value whose type is a union of types with call signatures add diagnostic message 2658: Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures. Closes #5640 --- src/compiler/diagnosticMessages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 331568eae22..f0d0dae20fa 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1007,7 +1007,7 @@ "category": "Error", "code": 2348 }, - "Cannot invoke an expression whose type lacks a call signature.": { + "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.": { "category": "Error", "code": 2349 }, From bc2b1050371c9aa0998b5d1e69cc6ff3ddbabea3 Mon Sep 17 00:00:00 2001 From: erictsangx Date: Thu, 26 Nov 2015 18:33:56 +0800 Subject: [PATCH 2/4] add tests for the issue --- .../types/union/unionTypeCallSignatures.ts | 14 +++++++------- .../types/union/unionTypeCallSignatures5.ts | 12 ++++++++++++ .../conformance/types/union/unionTypeMembers.ts | 3 +-- 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tests/cases/conformance/types/union/unionTypeCallSignatures5.ts diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts index a25d27d9a29..c15fa69ea91 100644 --- a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts @@ -16,9 +16,9 @@ unionOfDifferentReturnType1(true); // error in type of parameter unionOfDifferentReturnType1(); // error missing parameter var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; }; -unionOfDifferentParameterTypes(10);// error - no call signatures -unionOfDifferentParameterTypes("hello");// error - no call signatures -unionOfDifferentParameterTypes();// error - no call signatures +unionOfDifferentParameterTypes(10); //no error +unionOfDifferentParameterTypes("hello"); //no error +unionOfDifferentParameterTypes(); //error TS2346 var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures @@ -26,9 +26,9 @@ unionOfDifferentNumberOfSignatures(10); // error - no call signatures unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; -unionWithDifferentParameterCount();// no call signature -unionWithDifferentParameterCount("hello");// no call signature -unionWithDifferentParameterCount("hello", 10);// no call signature +unionWithDifferentParameterCount(); //error TS2346 +unionWithDifferentParameterCount("hello"); //no error +unionWithDifferentParameterCount("hello", 10); //no error var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); @@ -71,4 +71,4 @@ 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"); +strOrNum = unionWithRestParameter4("hello", "world"); \ No newline at end of file diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts new file mode 100644 index 00000000000..75626151807 --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts @@ -0,0 +1,12 @@ +interface A { + (number) : number; +} + +var f1: string | number; +f1(); //error TS2658 + +var f2: string | A; +f2(); //error TS2658 + +var f3: string[] | number[]; +f3.map(value=>value); //should not throw TS2349 \ No newline at end of file diff --git a/tests/cases/conformance/types/union/unionTypeMembers.ts b/tests/cases/conformance/types/union/unionTypeMembers.ts index 73c6867e9ac..00dc7562ccf 100644 --- a/tests/cases/conformance/types/union/unionTypeMembers.ts +++ b/tests/cases/conformance/types/union/unionTypeMembers.ts @@ -41,8 +41,7 @@ str = x.commonMethodType(str); // (a: string) => string so result should be stri strOrNum = x.commonPropertyDifferenType; strOrNum = x.commonMethodDifferentReturnType(str); // string | union x.commonMethodDifferentParameterType; // No error - property exists -x.commonMethodDifferentParameterType(strOrNum); // error - no call signatures because the type of this property is ((a: string) => string) | (a: number) => number - // and the call signatures arent identical +x.commonMethodDifferentParameterType(strOrNum); //error - TS2345 num = x.commonMethodWithTypeParameter(num); num = x.commonMethodWithOwnTypeParameter(num); str = x.commonMethodWithOwnTypeParameter(str); From 67573be64196f344611da4ce5ed716b029a95e3c Mon Sep 17 00:00:00 2001 From: erictsangx Date: Tue, 8 Dec 2015 17:48:58 +0800 Subject: [PATCH 3/4] improvements based on comments --- .gitignore | 1 + src/compiler/checker.ts | 11 ++++++++--- .../types/union/unionTypeCallSignatures.ts | 14 +++++++------- .../types/union/unionTypeCallSignatures5.ts | 12 ------------ .../conformance/types/union/unionTypeMembers.ts | 3 ++- 5 files changed, 18 insertions(+), 23 deletions(-) delete mode 100644 tests/cases/conformance/types/union/unionTypeCallSignatures5.ts diff --git a/.gitignore b/.gitignore index 05f981a0ace..b911f4ca106 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ internal/ .settings .vscode/* !.vscode/tasks.json +.idea \ No newline at end of file diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 30d4818592b..03d79b8376e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3854,6 +3854,11 @@ namespace ts { return false; } + function typeHasCallSignatures(type: Type): boolean { + const callSignature = getSignaturesOfType(type, SignatureKind.Call); + return !!callSignature.length; + } + function typeHasCallOrConstructSignatures(type: Type): boolean { const apparentType = getApparentType(type); if (apparentType.flags & TypeFlags.StructuredType) { @@ -9496,7 +9501,7 @@ namespace ts { error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); } else { - error(node, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + error(node, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); } return resolveErrorCall(node); } @@ -9586,7 +9591,7 @@ namespace ts { } if (!callSignatures.length) { - error(node, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + error(node, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); return resolveErrorCall(node); } @@ -9633,7 +9638,7 @@ namespace ts { const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { let errorInfo: DiagnosticMessageChain; - errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); errorInfo = chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(createDiagnosticForNodeFromMessageChain(node, errorInfo)); return resolveErrorCall(node); diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts index c15fa69ea91..a25d27d9a29 100644 --- a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts @@ -16,9 +16,9 @@ unionOfDifferentReturnType1(true); // error in type of parameter unionOfDifferentReturnType1(); // error missing parameter var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; }; -unionOfDifferentParameterTypes(10); //no error -unionOfDifferentParameterTypes("hello"); //no error -unionOfDifferentParameterTypes(); //error TS2346 +unionOfDifferentParameterTypes(10);// error - no call signatures +unionOfDifferentParameterTypes("hello");// error - no call signatures +unionOfDifferentParameterTypes();// error - no call signatures var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures @@ -26,9 +26,9 @@ unionOfDifferentNumberOfSignatures(10); // error - no call signatures unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; -unionWithDifferentParameterCount(); //error TS2346 -unionWithDifferentParameterCount("hello"); //no error -unionWithDifferentParameterCount("hello", 10); //no error +unionWithDifferentParameterCount();// no call signature +unionWithDifferentParameterCount("hello");// no call signature +unionWithDifferentParameterCount("hello", 10);// no call signature var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); @@ -71,4 +71,4 @@ 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"); \ No newline at end of file +strOrNum = unionWithRestParameter4("hello", "world"); diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts deleted file mode 100644 index 75626151807..00000000000 --- a/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts +++ /dev/null @@ -1,12 +0,0 @@ -interface A { - (number) : number; -} - -var f1: string | number; -f1(); //error TS2658 - -var f2: string | A; -f2(); //error TS2658 - -var f3: string[] | number[]; -f3.map(value=>value); //should not throw TS2349 \ No newline at end of file diff --git a/tests/cases/conformance/types/union/unionTypeMembers.ts b/tests/cases/conformance/types/union/unionTypeMembers.ts index 00dc7562ccf..73c6867e9ac 100644 --- a/tests/cases/conformance/types/union/unionTypeMembers.ts +++ b/tests/cases/conformance/types/union/unionTypeMembers.ts @@ -41,7 +41,8 @@ str = x.commonMethodType(str); // (a: string) => string so result should be stri strOrNum = x.commonPropertyDifferenType; strOrNum = x.commonMethodDifferentReturnType(str); // string | union x.commonMethodDifferentParameterType; // No error - property exists -x.commonMethodDifferentParameterType(strOrNum); //error - TS2345 +x.commonMethodDifferentParameterType(strOrNum); // error - no call signatures because the type of this property is ((a: string) => string) | (a: number) => number + // and the call signatures arent identical num = x.commonMethodWithTypeParameter(num); num = x.commonMethodWithOwnTypeParameter(num); str = x.commonMethodWithOwnTypeParameter(str); From 557433e5b4600fb3b4e4d598b04ba593f9861d67 Mon Sep 17 00:00:00 2001 From: erictsangx Date: Tue, 8 Dec 2015 18:16:00 +0800 Subject: [PATCH 4/4] baseline accept --- .../reference/callOnInstance.errors.txt | 4 ++-- ...putedPropertiesInDestructuring1.errors.txt | 8 +++---- ...dPropertiesInDestructuring1_ES6.errors.txt | 8 +++---- .../constructorOverloads4.errors.txt | 4 ++-- ...ctionExpressionShadowedByParams.errors.txt | 4 ++-- ...ropertiesInheritedIntoClassType.errors.txt | 8 +++---- .../instancePropertyInClassType.errors.txt | 8 +++---- .../strictModeReservedWord.errors.txt | 4 ++-- ...rCallParameterContextualTyping2.errors.txt | 4 ++-- .../templateStringInCallExpression.errors.txt | 4 ++-- ...mplateStringInCallExpressionES6.errors.txt | 4 ++-- .../templateStringInObjectLiteral.errors.txt | 4 ++-- ...emplateStringInObjectLiteralES6.errors.txt | 4 ++-- .../templateStringInPropertyName1.errors.txt | 4 ++-- .../templateStringInPropertyName2.errors.txt | 4 ++-- ...mplateStringInPropertyNameES6_1.errors.txt | 4 ++-- ...mplateStringInPropertyNameES6_2.errors.txt | 4 ++-- .../templateStringInTaggedTemplate.errors.txt | 4 ++-- ...mplateStringInTaggedTemplateES6.errors.txt | 4 ++-- .../unionTypeCallSignatures.errors.txt | 24 +++++++++---------- .../reference/unionTypeMembers.errors.txt | 4 ++-- ...unctionCallsWithTypeParameters1.errors.txt | 4 ++-- 22 files changed, 62 insertions(+), 62 deletions(-) diff --git a/tests/baselines/reference/callOnInstance.errors.txt b/tests/baselines/reference/callOnInstance.errors.txt index 156bdfd512a..4f80088ab75 100644 --- a/tests/baselines/reference/callOnInstance.errors.txt +++ b/tests/baselines/reference/callOnInstance.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'. tests/cases/compiler/callOnInstance.ts(7,19): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/callOnInstance.ts(7,19): error TS2350: Only a void function can be called with the 'new' keyword. -tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures. ==== tests/cases/compiler/callOnInstance.ts (5 errors) ==== @@ -25,4 +25,4 @@ tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an exp declare class C { constructor(value: number); } (new C(1))(); // Error for calling an instance ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt index dc536e544b2..ca1c0f4c0b9 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,12): error TS2339: Property 'toExponential' does not exist on type 'string'. -tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. @@ -26,7 +26,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: // report errors on type errors in computed properties used in destructuring let [{[foo()]: bar6}] = [{bar: "bar"}]; ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; ~~~~~~~~~~~~~ !!! error TS2339: Property 'toExponential' does not exist on type 'string'. @@ -43,7 +43,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: [{[foo()]: bar4}] = [{bar: "bar"}]; ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; ~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt index 96ab892d1b9..9a332d6aee8 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,8): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,12): error TS2339: Property 'toExponential' does not exist on type 'string'. -tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. @@ -27,7 +27,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS23 // report errors on type errors in computed properties used in destructuring let [{[foo()]: bar6}] = [{bar: "bar"}]; ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; ~~~~~~~~~~~~~ !!! error TS2339: Property 'toExponential' does not exist on type 'string'. @@ -44,7 +44,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS23 [{[foo()]: bar4}] = [{bar: "bar"}]; ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; ~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'. diff --git a/tests/baselines/reference/constructorOverloads4.errors.txt b/tests/baselines/reference/constructorOverloads4.errors.txt index d2cc5ecd65b..3e6923d25dc 100644 --- a/tests/baselines/reference/constructorOverloads4.errors.txt +++ b/tests/baselines/reference/constructorOverloads4.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/constructorOverloads4.ts(2,18): error TS2300: Duplicate identifier 'Function'. tests/cases/compiler/constructorOverloads4.ts(5,21): error TS2300: Duplicate identifier 'Function'. tests/cases/compiler/constructorOverloads4.ts(6,21): error TS2300: Duplicate identifier 'Function'. -tests/cases/compiler/constructorOverloads4.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/constructorOverloads4.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Function' has no compatible call signatures. tests/cases/compiler/constructorOverloads4.ts(11,1): error TS2348: Value of type 'typeof Function' is not callable. Did you mean to include 'new'? @@ -23,7 +23,7 @@ tests/cases/compiler/constructorOverloads4.ts(11,1): error TS2348: Value of type (new M.Function("return 5"))(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Function' has no compatible call signatures. M.Function("yo"); ~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Function' is not callable. Did you mean to include 'new'? diff --git a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt index 74b4c171a57..f0d821d89c1 100644 --- a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt +++ b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionExpressionShadowedByParams.ts(3,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/functionExpressionShadowedByParams.ts(3,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. tests/cases/compiler/functionExpressionShadowedByParams.ts(10,9): error TS2339: Property 'apply' does not exist on type 'number'. @@ -7,7 +7,7 @@ tests/cases/compiler/functionExpressionShadowedByParams.ts(10,9): error TS2339: b1.toPrecision(2); // should not error b1(12); // should error ~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. } diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index 340b5081866..21aaa938093 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn r.y = 4; var r6 = d.y(); // error ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. } @@ -59,5 +59,5 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn r.y = ''; var r6 = d.y(); // error ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/instancePropertyInClassType.errors.txt b/tests/baselines/reference/instancePropertyInClassType.errors.txt index d14607d81bc..bb0047880cb 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts (6 errors) ==== @@ -29,7 +29,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t r.y = 4; var r6 = c.y(); // error ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. } @@ -55,5 +55,5 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t r.y = ''; var r6 = c.y(); // error ~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 02ece81a1d9..7a1bacbb525 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -40,7 +40,7 @@ tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1212: Identifier tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2304: Cannot find name 'ublic'. tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS1212: Identifier expected. 'static' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/compiler/strictModeReservedWord.ts (43 errors) ==== @@ -153,7 +153,7 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~~~~~~ !!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode ~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt b/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt index a1e89d41efc..92451ffd056 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt +++ b/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts(10,43): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts(10,43): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. ==== tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts (1 errors) ==== @@ -13,5 +13,5 @@ tests/cases/conformance/expressions/contextualTyping/superCallParameterContextua // Ensure 'value' is not of type 'any' by invoking it with type arguments. constructor() { super(value => String(value())); } ~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInCallExpression.errors.txt b/tests/baselines/reference/templateStringInCallExpression.errors.txt index c483fd9d4c0..cd5e2ff7c63 100644 --- a/tests/baselines/reference/templateStringInCallExpression.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpression.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInCallExpression.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInCallExpression.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/es6/templates/templateStringInCallExpression.ts (1 errors) ==== `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt b/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt index 7a391b6afe7..fd47a8001ad 100644 --- a/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInCallExpressionES6.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInCallExpressionES6.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/es6/templates/templateStringInCallExpressionES6.ts (1 errors) ==== `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt index dcc8d565b75..234ccfdcae5 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,8): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,10): error TS1134: Variable declaration expected. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): err ~~~~~~~~~~~~~~~~~~~~~~~~ `b`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt index ab914fabb8b..4c78dbea2cb 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,8): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,10): error TS1134: Variable declaration expected. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(4,1): ~~~~~~~~~~~~~~~~~~~~~~~~ `b`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName1.errors.txt b/tests/baselines/reference/templateStringInPropertyName1.errors.txt index 306c6a651e4..15f4415611b 100644 --- a/tests/baselines/reference/templateStringInPropertyName1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,8): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(2,10): error TS1134: Variable declaration expected. @@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(3,1): err ~ `a`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName2.errors.txt b/tests/baselines/reference/templateStringInPropertyName2.errors.txt index e004eec9bba..d9e5d73dd06 100644 --- a/tests/baselines/reference/templateStringInPropertyName2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,32): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(2,34): error TS1134: Variable declaration expected. @@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(3,1): err ~ `abc${ 123 }def${ 456 }ghi`: 321 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. ~~~~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt b/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt index 3576effe560..620b3248558 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(2,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(2,8): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(2,10): error TS1134: Variable declaration expected. @@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(3,1): ~ `a`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt b/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt index 37e7dc8c0f8..00ef4e511bc 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(1,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(2,5): error TS1136: Property assignment expected. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(2,32): error TS1005: ',' expected. tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(2,34): error TS1134: Variable declaration expected. @@ -10,7 +10,7 @@ tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(3,1): ~ `abc${ 123 }def${ 456 }ghi`: 321 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. ~~~~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 18ce24a0b3b..9494f03a8bf 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt index fd30d7f4074..581e084e738 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInTaggedTemplateES6.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInTaggedTemplateES6.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. ==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplateES6.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index bf1de6ff8e8..fe0fff0f7e8 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -2,14 +2,14 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(9,43): error TS23 tests/cases/conformance/types/union/unionTypeCallSignatures.ts(10,29): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(15,29): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(19,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(20,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(21,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(19,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(20,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(21,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(24,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(26,36): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(29,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(30,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(31,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(29,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(30,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(31,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(36,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(37,12): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(40,12): error TS2346: Supplied parameters do not match any signature of call target. @@ -60,13 +60,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; }; unionOfDifferentParameterTypes(10);// error - no call signatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. unionOfDifferentParameterTypes("hello");// error - no call signatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. unionOfDifferentParameterTypes();// error - no call signatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: number) => number) | ((a: string) => Date)' has no compatible call signatures. var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures @@ -80,13 +80,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. unionWithDifferentParameterCount("hello");// no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. unionWithDifferentParameterCount("hello", 10);// no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: string, b: number) => number)' has no compatible call signatures. var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); diff --git a/tests/baselines/reference/unionTypeMembers.errors.txt b/tests/baselines/reference/unionTypeMembers.errors.txt index 21f1204ac6d..13aaedd631f 100644 --- a/tests/baselines/reference/unionTypeMembers.errors.txt +++ b/tests/baselines/reference/unionTypeMembers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/union/unionTypeMembers.ts(44,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/types/union/unionTypeMembers.ts(44,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: number) => number)' has no compatible call signatures. tests/cases/conformance/types/union/unionTypeMembers.ts(51,3): error TS2339: Property 'propertyOnlyInI1' does not exist on type 'I1 | I2'. tests/cases/conformance/types/union/unionTypeMembers.ts(52,3): error TS2339: Property 'propertyOnlyInI2' does not exist on type 'I1 | I2'. tests/cases/conformance/types/union/unionTypeMembers.ts(53,3): error TS2339: Property 'methodOnlyInI1' does not exist on type 'I1 | I2'. @@ -51,7 +51,7 @@ tests/cases/conformance/types/union/unionTypeMembers.ts(54,3): error TS2339: Pro x.commonMethodDifferentParameterType; // No error - property exists x.commonMethodDifferentParameterType(strOrNum); // error - no call signatures because the type of this property is ((a: string) => string) | (a: number) => number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((a: string) => string) | ((a: number) => number)' has no compatible call signatures. // and the call signatures arent identical num = x.commonMethodWithTypeParameter(num); num = x.commonMethodWithOwnTypeParameter(num); diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt index c6cd96578b4..399a37c32fd 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(5,10): error TS2 tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(8,10): error TS2347: Untyped function calls may not accept type arguments. tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(10,7): error TS2420: Class 'C' incorrectly implements interface 'Function'. Property 'apply' is missing in type 'C'. -tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(18,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(18,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures. tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(22,10): error TS2347: Untyped function calls may not accept type arguments. tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(28,10): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(35,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -39,7 +39,7 @@ tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(41,1): error TS2 var c2: C; var r4 = c2(); // should be an error ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures. class C2 extends Function { } // error var c3: C2;