From 768318b30c44259cd9a408873e0a57fa8c288c20 Mon Sep 17 00:00:00 2001 From: Titian Cernicova-Dragomir Date: Sat, 22 Jun 2019 02:28:03 +0300 Subject: [PATCH 1/3] Improved error message for calling/constructing types --- src/compiler/checker.ts | 82 +++++++++++++++++-- src/compiler/diagnosticMessages.json | 36 +++++++- .../codefixes/fixInvalidImportSyntax.ts | 6 +- .../betterErrorForAccidentalCall.errors.txt | 30 ++++--- .../reference/callOnInstance.errors.txt | 6 +- ...putedPropertiesInDestructuring1.errors.txt | 12 ++- ...dPropertiesInDestructuring1_ES6.errors.txt | 12 ++- ...constructableDecoratorOnClass01.errors.txt | 6 +- .../exponentiationOperatorWithNew.errors.txt | 6 +- ...ctionExpressionShadowedByParams.errors.txt | 6 +- ...ericArrayAssignmentCompatErrors.errors.txt | 6 +- ...ropertiesInheritedIntoClassType.errors.txt | 12 ++- .../instancePropertyInClassType.errors.txt | 12 ++- .../reference/intTypeCheck.errors.txt | 72 ++++++++++------ .../narrowFromAnyWithTypePredicate.errors.txt | 6 +- .../reference/neverTypeErrors1.errors.txt | 6 +- .../reference/neverTypeErrors2.errors.txt | 6 +- .../reference/newAbstractInstance.errors.txt | 6 +- .../reference/newOnInstanceSymbol.errors.txt | 6 +- .../reference/newOperator.errors.txt | 50 +++++++++-- tests/baselines/reference/newOperator.js | 14 ++++ tests/baselines/reference/newOperator.symbols | 49 ++++++++--- tests/baselines/reference/newOperator.types | 31 +++++++ .../reference/objectSpreadNegative.errors.txt | 6 +- ...cursiveBaseConstructorCreation3.errors.txt | 6 +- .../staticMemberExportAccess.errors.txt | 6 +- .../strictModeReservedWord.errors.txt | 6 +- ...rCallParameterContextualTyping2.errors.txt | 6 +- .../reference/superNewCall1.errors.txt | 6 +- ...dTemplateWithConstructableTag01.errors.txt | 6 +- ...dTemplateWithConstructableTag02.errors.txt | 6 +- .../templateStringInCallExpression.errors.txt | 6 +- ...mplateStringInCallExpressionES6.errors.txt | 6 +- .../templateStringInNewExpression.errors.txt | 6 +- ...emplateStringInNewExpressionES6.errors.txt | 6 +- .../templateStringInNewOperator.errors.txt | 6 +- .../templateStringInNewOperatorES6.errors.txt | 6 +- .../templateStringInObjectLiteral.errors.txt | 6 +- ...emplateStringInObjectLiteralES6.errors.txt | 6 +- .../templateStringInPropertyName1.errors.txt | 6 +- .../templateStringInPropertyName2.errors.txt | 6 +- ...mplateStringInPropertyNameES6_1.errors.txt | 6 +- ...mplateStringInPropertyNameES6_2.errors.txt | 6 +- .../templateStringInTaggedTemplate.errors.txt | 6 +- ...mplateStringInTaggedTemplateES6.errors.txt | 6 +- ...ameterWithInvalidConstraintType.errors.txt | 12 ++- ...unctionCallsWithTypeParameters1.errors.txt | 6 +- tests/cases/compiler/newOperator.ts | 11 +++ 48 files changed, 491 insertions(+), 148 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cf614ee201395..cd90880654ce3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22015,11 +22015,83 @@ namespace ts { return true; } + function invocationErrorDetails(apparentType: Type, kind: SignatureKind): DiagnosticMessageChain { + let errorInfo: DiagnosticMessageChain | undefined; + const isCall = kind === SignatureKind.Call; + if (apparentType.flags & TypeFlags.Union) { + const types = (apparentType as UnionType).types; + let hasSignatures = false; + for (const constituent of types) { + const signatures = getSignaturesOfType(constituent, kind); + if (signatures.length !== 0) { + hasSignatures = true; + if (errorInfo) { + // Bail early if we already have an error, no chance of "No constituent of type is callable" + break; + } + } + else { + // Error on the first non callable constituent only + if (!errorInfo) { + errorInfo = chainDiagnosticMessages( + errorInfo, + isCall ? + Diagnostics.Type_0_has_no_call_signatures : + Diagnostics.Type_0_has_no_construct_signatures, + typeToString(constituent) + ); + errorInfo = chainDiagnosticMessages( + errorInfo, + isCall ? + Diagnostics.Not_all_constituents_of_type_0_are_callable : + Diagnostics.Not_all_constituents_of_type_0_are_constructable, + typeToString(apparentType) + ); + } + if (hasSignatures) { + // Bail early if we already found a siganture, no chance of "No constituent of type is callable" + break; + } + } + } + if (!hasSignatures) { + errorInfo = chainDiagnosticMessages( + /* detials */ undefined, + isCall ? + Diagnostics.No_constituent_of_type_0_is_callable : + Diagnostics.No_constituent_of_type_0_is_constructable, + typeToString(apparentType) + ); + } + if (!errorInfo) { + errorInfo = chainDiagnosticMessages( + errorInfo, + isCall ? + Diagnostics.Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other : + Diagnostics.Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other, + typeToString(apparentType) + ); + } + } + else { + errorInfo = chainDiagnosticMessages( + errorInfo, + isCall ? + Diagnostics.Type_0_has_no_call_signatures : + Diagnostics.Type_0_has_no_construct_signatures, + typeToString(apparentType) + ); + } + return chainDiagnosticMessages( + errorInfo, + isCall ? + Diagnostics.This_expression_is_not_callable : + Diagnostics.This_expression_is_not_constructable + ); + } function invocationError(node: Node, apparentType: Type, kind: SignatureKind, relatedInformation?: DiagnosticRelatedInformation) { - const diagnostic = error(node, (kind === SignatureKind.Call ? - Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures : - Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature - ), typeToString(apparentType)); + const diagnostic: Diagnostic = createDiagnosticForNodeFromMessageChain(node, invocationErrorDetails(apparentType, kind)); + diagnostics.add(diagnostic); invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic); } @@ -22113,7 +22185,7 @@ namespace ts { const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - let errorInfo = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); + let errorInfo = invocationErrorDetails(apparentType, SignatureKind.Call); errorInfo = chainDiagnosticMessages(errorInfo, headMessage); const diag = createDiagnosticForNodeFromMessageChain(node, errorInfo); diagnostics.add(diag); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0f02c79172c2e..7d178f1d47892 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1236,7 +1236,7 @@ "category": "Error", "code": 2348 }, - "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.": { + "This expression is not callable.": { "category": "Error", "code": 2349 }, @@ -1244,7 +1244,7 @@ "category": "Error", "code": 2350 }, - "Cannot use 'new' with an expression whose type lacks a call or construct signature.": { + "This expression is not constructable.": { "category": "Error", "code": 2351 }, @@ -2621,6 +2621,38 @@ "category": "Error", "code": 2754 }, + "No constituent of type '{0}' is callable.": { + "category": "Error", + "code": 2755 + }, + "Not all constituents of type '{0}' are callable.": { + "category": "Error", + "code": 2756 + }, + "Type '{0}' has no call signatures.": { + "category": "Error", + "code": 2757 + }, + "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other.": { + "category": "Error", + "code": 2758 + }, + "No constituent of type '{0}' is constructable.": { + "category": "Error", + "code": 2759 + }, + "Not all constituents of type '{0}' are constructable.": { + "category": "Error", + "code": 2760 + }, + "Type '{0}' has no construct signatures.": { + "category": "Error", + "code": 2761 + }, + "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other.": { + "category": "Error", + "code": 2762 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 85dff7fb09be6..4ef030d62e5a7 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -31,15 +31,15 @@ namespace ts.codefix { registerCodeFix({ errorCodes: [ - Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code, - Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature.code, + Diagnostics.This_expression_is_not_callable.code, + Diagnostics.This_expression_is_not_constructable.code, ], getCodeActions: getActionsForUsageOfInvalidImport }); function getActionsForUsageOfInvalidImport(context: CodeFixContext): CodeFixAction[] | undefined { const sourceFile = context.sourceFile; - const targetKind = Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? SyntaxKind.CallExpression : SyntaxKind.NewExpression; + const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? SyntaxKind.CallExpression : SyntaxKind.NewExpression; const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), a => a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length)) as CallExpression | NewExpression; if (!node) { return []; diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt index f5358b45a4fa3..5c67734b34c5a 100644 --- a/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt +++ b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt @@ -1,8 +1,13 @@ -tests/cases/compiler/betterErrorForAccidentalCall.ts(3,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -tests/cases/compiler/betterErrorForAccidentalCall.ts(5,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -tests/cases/compiler/betterErrorForAccidentalCall.ts(7,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -tests/cases/compiler/betterErrorForAccidentalCall.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -tests/cases/compiler/betterErrorForAccidentalCall.ts(13,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +tests/cases/compiler/betterErrorForAccidentalCall.ts(3,1): error TS2349: This expression is not callable. + Type 'String' has no call signatures. +tests/cases/compiler/betterErrorForAccidentalCall.ts(5,1): error TS2349: This expression is not callable. + Type 'String' has no call signatures. +tests/cases/compiler/betterErrorForAccidentalCall.ts(7,1): error TS2349: This expression is not callable. + Type 'String' has no call signatures. +tests/cases/compiler/betterErrorForAccidentalCall.ts(10,1): error TS2349: This expression is not callable. + Type 'String' has no call signatures. +tests/cases/compiler/betterErrorForAccidentalCall.ts(13,1): error TS2349: This expression is not callable. + Type 'String' has no call signatures. ==== tests/cases/compiler/betterErrorForAccidentalCall.ts (5 errors) ==== @@ -10,30 +15,35 @@ tests/cases/compiler/betterErrorForAccidentalCall.ts(13,1): error TS2349: Cannot foo()(1 as number).toString(); ~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. foo() (1 as number).toString(); ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. foo() ~~~~~ (1 as number).toString(); ~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:7:1: It is highly likely that you are missing a semicolon. foo() ~~~~~ (1 + 2).toString(); ~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:10:1: It is highly likely that you are missing a semicolon. foo() ~~~~~ (1).toString(); ~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:13:1: It is highly likely that you are missing a semicolon. \ No newline at end of file diff --git a/tests/baselines/reference/callOnInstance.errors.txt b/tests/baselines/reference/callOnInstance.errors.txt index 16ea001c99e35..7b6010df12aaf 100644 --- a/tests/baselines/reference/callOnInstance.errors.txt +++ b/tests/baselines/reference/callOnInstance.errors.txt @@ -1,7 +1,8 @@ tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier 'D'. tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'. tests/cases/compiler/callOnInstance.ts(7,25): error TS2554: Expected 0 arguments, but got 1. -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(10,1): error TS2349: This expression is not callable. + Type 'C' has no call signatures. ==== tests/cases/compiler/callOnInstance.ts (4 errors) ==== @@ -22,4 +23,5 @@ 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. Type 'C' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'C' has no 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 dc71d916a36fa..3cdab34055c30 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt @@ -6,7 +6,8 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(14,15): error TS2537: tests/cases/compiler/computedPropertiesInDestructuring1.ts(15,15): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(16,16): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(17,16): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. -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(20,8): error TS2349: This expression is not callable. + Type 'String' has no call signatures. tests/cases/compiler/computedPropertiesInDestructuring1.ts(20,8): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,8): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1.ts(21,12): error TS2339: Property 'toExponential' does not exist on type 'string'. @@ -14,7 +15,8 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(24,4): error TS2537: tests/cases/compiler/computedPropertiesInDestructuring1.ts(28,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(30,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1.ts(31,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. -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(33,4): error TS2349: This expression is not callable. + Type 'String' has no call signatures. tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,4): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'. @@ -58,7 +60,8 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. ~~~~~ !!! error TS2538: Type 'any' cannot be used as an index type. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; @@ -87,7 +90,8 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. ~~~~~ !!! error TS2538: Type 'any' cannot be used as an index type. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt index b839a20974346..867b0ca7a450d 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt @@ -6,7 +6,8 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(15,15): error TS2 tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(16,15): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(17,16): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(18,16): error TS2537: Type '{ bar: number; }' has no matching index signature for type 'string'. -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(21,8): error TS2349: This expression is not callable. + Type 'String' has no call signatures. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(21,8): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,8): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(22,12): error TS2339: Property 'toExponential' does not exist on type 'string'. @@ -14,7 +15,8 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(25,4): error TS25 tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(29,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(31,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(32,4): error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. -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(34,4): error TS2349: This expression is not callable. + Type 'String' has no call signatures. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,4): error TS2538: Type 'any' cannot be used as an index type. tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'. @@ -59,7 +61,8 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. ~~~~~ !!! error TS2538: Type 'any' cannot be used as an index type. let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; @@ -88,7 +91,8 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. ~~~~~ !!! error TS2538: Type 'any' cannot be used as an index type. [{[(1 + {})]: bar4}] = [{bar: "bar"}]; diff --git a/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt b/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt index ef088d893518f..742bfc7cfbf70 100644 --- a/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt +++ b/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. - Cannot invoke an expression whose type lacks a call signature. Type 'typeof CtorDtor' has no compatible call signatures. + This expression is not callable. + Type 'typeof CtorDtor' has no call signatures. ==== tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts (1 errors) ==== @@ -8,7 +9,8 @@ tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts(3,1) @CtorDtor ~~~~~~~~~ !!! error TS1238: Unable to resolve signature of class decorator when called as an expression. -!!! error TS1238: Cannot invoke an expression whose type lacks a call signature. Type 'typeof CtorDtor' has no compatible call signatures. +!!! error TS1238: This expression is not callable. +!!! error TS1238: Type 'typeof CtorDtor' has no call signatures. class C { } diff --git a/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt b/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt index ae694a321b48e..449af44e322cf 100644 --- a/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew.ts(6,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew.ts(6,1): error TS2351: This expression is not constructable. + Type 'Number' has no construct signatures. ==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew.ts (1 errors) ==== @@ -9,4 +10,5 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew new a ** new b ** c; new (a ** b ** c); ~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'Number' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt index f0d821d89c189..a27810e9fc752 100644 --- a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt +++ b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt @@ -1,4 +1,5 @@ -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(3,4): error TS2349: This expression is not callable. + Type 'Number' has no call signatures. tests/cases/compiler/functionExpressionShadowedByParams.ts(10,9): error TS2339: Property 'apply' does not exist on type 'number'. @@ -7,7 +8,8 @@ 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. Type 'Number' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'Number' has no call signatures. } diff --git a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt index 02ac17bb10cd7..ac6b1df60b429 100644 --- a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt +++ b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt @@ -1,4 +1,5 @@ -tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(2,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(2,15): error TS2351: This expression is not constructable. + Type 'undefined[]' has no construct signatures. tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'Array' requires 1 type argument(s). @@ -6,7 +7,8 @@ tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: var myCars=new Array(); var myCars2 = new []; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'undefined[]' has no construct signatures. var myCars3 = new Array({}); var myCars4: Array; // error ~~~~~ diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index 21aaa938093e1..4d9330d16ff33 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,9 +1,11 @@ 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. Type 'Number' has no compatible call signatures. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: This expression is not callable. + Type 'Number' has no 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. Type 'String' has no compatible call signatures. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: This expression is not callable. + Type 'String' has no call signatures. ==== tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts (6 errors) ==== @@ -31,7 +33,8 @@ 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. Type 'Number' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'Number' has no call signatures. } @@ -59,5 +62,6 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no 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 bb0047880cbd8..65d72b91832b9 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,9 +1,11 @@ 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. Type 'Number' has no compatible call signatures. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: This expression is not callable. + Type 'Number' has no 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. Type 'String' has no compatible call signatures. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: This expression is not callable. + Type 'String' has no call signatures. ==== tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts (6 errors) ==== @@ -29,7 +31,8 @@ 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. Type 'Number' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'Number' has no call signatures. } @@ -55,5 +58,6 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 326ad2f18cd50..2915e869095ca 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -3,13 +3,15 @@ tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/intTypeCheck.ts(99,5): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'i1': p, p3, p6 -tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: This expression is not constructable. + Type 'i1' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(101,5): error TS2739: Type 'Base' is missing the following properties from type 'i1': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(103,5): error TS2739: Type '() => void' is missing the following properties from type 'i1': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(106,21): error TS2693: 'i1' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. Type '{}' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'. @@ -21,7 +23,8 @@ tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not as tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(120,22): error TS2693: 'i2' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. Type '{}' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'. @@ -34,22 +37,27 @@ tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(134,22): error TS2693: 'i3' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. +tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: This expression is not constructable. + Type 'i4' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(148,22): error TS2693: 'i4' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(154,5): error TS2739: Type '{}' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(155,5): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'i5': p, p3, p6 -tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: This expression is not constructable. + Type 'i5' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(157,5): error TS2739: Type 'Base' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(159,5): error TS2739: Type '() => void' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(162,22): error TS2693: 'i5' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. Type '{}' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'. @@ -63,7 +71,8 @@ tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(176,22): error TS2693: 'i6' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. Type '{}' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. @@ -76,12 +85,15 @@ tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(190,22): error TS2693: 'i7' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. +tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: This expression is not constructable. + Type 'i8' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(204,22): error TS2693: 'i8' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. ==== tests/cases/compiler/intTypeCheck.ts (63 errors) ==== @@ -195,7 +207,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2696: Type 'Object' is missing the following properties from type 'i1': p, p3, p6 var obj3: i1 = new obj0; ~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'i1' has no construct signatures. var obj4: i1 = new Base; ~~~~ !!! error TS2739: Type 'Base' is missing the following properties from type 'i1': p, p3, p6 @@ -214,7 +227,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i1' only refers to a type, but is being used as a value here. var obj10: i1 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Call signatures // @@ -248,7 +262,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i2' only refers to a type, but is being used as a value here. var obj21: i2 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Construct Signatures // @@ -283,7 +298,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i3' only refers to a type, but is being used as a value here. var obj32: i3 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Index Signatures // @@ -292,7 +308,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj35: i4 = new Object(); var obj36: i4 = new obj33; ~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'i4' has no construct signatures. var obj37: i4 = new Base; var obj38: i4 = null; var obj39: i4 = function () { }; @@ -307,7 +324,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i4' only refers to a type, but is being used as a value here. var obj43: i4 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Interface Derived I1 // @@ -321,7 +339,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2696: Type 'Object' is missing the following properties from type 'i5': p, p3, p6 var obj47: i5 = new obj44; ~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'i5' has no construct signatures. var obj48: i5 = new Base; ~~~~~ !!! error TS2739: Type 'Base' is missing the following properties from type 'i5': p, p3, p6 @@ -340,7 +359,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i5' only refers to a type, but is being used as a value here. var obj54: i5 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Interface Derived I2 // @@ -377,7 +397,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i6' only refers to a type, but is being used as a value here. var obj65: i6 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Interface Derived I3 // @@ -412,7 +433,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i7' only refers to a type, but is being used as a value here. var obj76: i7 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. // // Interface Derived I4 // @@ -421,7 +443,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj79: i8 = new Object(); var obj80: i8 = new obj77; ~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'i8' has no construct signatures. var obj81: i8 = new Base; var obj82: i8 = null; var obj83: i8 = function () { }; @@ -436,4 +459,5 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit !!! error TS2693: 'i8' only refers to a type, but is being used as a value here. var obj87: i8 = new {}; ~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index 0cf20b5c86bab..d7a5196b04d80 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(22,7): error TS2339: Property 'method' does not exist on type '{}'. -tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(23,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(23,5): error TS2349: This expression is not callable. + Type '{}' has no call signatures. tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(28,7): error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? @@ -31,7 +32,8 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error !!! error TS2339: Property 'method' does not exist on type '{}'. x(); ~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. } if (isError(x)) { diff --git a/tests/baselines/reference/neverTypeErrors1.errors.txt b/tests/baselines/reference/neverTypeErrors1.errors.txt index c0dd83fb1cc0a..98a488f5fe492 100644 --- a/tests/baselines/reference/neverTypeErrors1.errors.txt +++ b/tests/baselines/reference/neverTypeErrors1.errors.txt @@ -4,7 +4,8 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type tests/cases/conformance/types/never/neverTypeErrors1.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors1.ts(9,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. +tests/cases/conformance/types/never/neverTypeErrors1.ts(9,5): error TS2349: This expression is not callable. + Type 'never' has no call signatures. tests/cases/conformance/types/never/neverTypeErrors1.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(17,5): error TS2322: Type '1' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. @@ -35,7 +36,8 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(24,17): error TS2407: Th !!! error TS2322: Type '{}' is not assignable to type 'never'. x(); ~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'never' has no call signatures. } function f2(): never { diff --git a/tests/baselines/reference/neverTypeErrors2.errors.txt b/tests/baselines/reference/neverTypeErrors2.errors.txt index b81323cbfbc8e..00f270c538487 100644 --- a/tests/baselines/reference/neverTypeErrors2.errors.txt +++ b/tests/baselines/reference/neverTypeErrors2.errors.txt @@ -4,7 +4,8 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(5,5): error TS2322: Type tests/cases/conformance/types/never/neverTypeErrors2.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors2.ts(9,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. +tests/cases/conformance/types/never/neverTypeErrors2.ts(9,5): error TS2349: This expression is not callable. + Type 'never' has no call signatures. tests/cases/conformance/types/never/neverTypeErrors2.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(17,5): error TS2322: Type '1' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. @@ -35,7 +36,8 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(24,17): error TS2407: Th !!! error TS2322: Type '{}' is not assignable to type 'never'. x(); ~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'never' has no call signatures. } function f2(): never { diff --git a/tests/baselines/reference/newAbstractInstance.errors.txt b/tests/baselines/reference/newAbstractInstance.errors.txt index 13a5aff9df354..bbb9fdae74ca2 100644 --- a/tests/baselines/reference/newAbstractInstance.errors.txt +++ b/tests/baselines/reference/newAbstractInstance.errors.txt @@ -1,4 +1,5 @@ -tests/cases/compiler/newAbstractInstance.ts(3,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newAbstractInstance.ts(3,1): error TS2351: This expression is not constructable. + Type 'B' has no construct signatures. ==== tests/cases/compiler/newAbstractInstance.ts (1 errors) ==== @@ -6,5 +7,6 @@ tests/cases/compiler/newAbstractInstance.ts(3,1): error TS2351: Cannot use 'new' declare const b: B; new b(); ~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'B' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/newOnInstanceSymbol.errors.txt b/tests/baselines/reference/newOnInstanceSymbol.errors.txt index 99af44524cdb7..7a7d6a4ce9c3c 100644 --- a/tests/baselines/reference/newOnInstanceSymbol.errors.txt +++ b/tests/baselines/reference/newOnInstanceSymbol.errors.txt @@ -1,4 +1,5 @@ -tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: This expression is not constructable. + Type 'C' has no construct signatures. ==== tests/cases/compiler/newOnInstanceSymbol.ts (1 errors) ==== @@ -6,4 +7,5 @@ tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: Cannot use 'new' var x = new C(); // should be ok new x(); // should error ~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'C' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index fb98482d85caa..00bd2f9ac1780 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -1,17 +1,27 @@ tests/cases/compiler/newOperator.ts(3,13): error TS2693: 'ifc' only refers to a type, but is being used as a value here. -tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newOperator.ts(10,10): error TS2351: This expression is not constructable. + Type 'Number' has no construct signatures. +tests/cases/compiler/newOperator.ts(11,10): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. tests/cases/compiler/newOperator.ts(12,5): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/newOperator.ts(18,14): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/newOperator.ts(18,21): error TS1011: An element access expression should take an argument. tests/cases/compiler/newOperator.ts(21,1): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/newOperator.ts(22,2): error TS1011: An element access expression should take an argument. tests/cases/compiler/newOperator.ts(28,13): error TS2304: Cannot find name 'q'. -tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/newOperator.ts(45,24): error TS1011: An element access expression should take an argument. +tests/cases/compiler/newOperator.ts(31,10): error TS2351: This expression is not constructable. + Type 'Date' has no construct signatures. +tests/cases/compiler/newOperator.ts(38,1): error TS2351: This expression is not constructable. + No constituent of type '{ a: string; } | { b: string; }' is constructable. +tests/cases/compiler/newOperator.ts(42,1): error TS2351: This expression is not constructable. + Not all constituents of type '{ a: string; } | (new (a: string) => void)' are constructable. + Type '{ a: string; }' has no construct signatures. +tests/cases/compiler/newOperator.ts(46,1): error TS2351: This expression is not constructable. + Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. +tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expression should take an argument. -==== tests/cases/compiler/newOperator.ts (11 errors) ==== +==== tests/cases/compiler/newOperator.ts (14 errors) ==== interface ifc { } // Attempting to 'new' an interface yields poor error var i = new ifc(); @@ -25,10 +35,12 @@ tests/cases/compiler/newOperator.ts(45,24): error TS1011: An element access expr // Target is not a class or var, good error var t1 = new 53(); ~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'Number' has no construct signatures. var t2 = new ''(); ~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. new string; ~~~~~~ !!! error TS2693: 'string' only refers to a type, but is being used as a value here. @@ -62,11 +74,33 @@ tests/cases/compiler/newOperator.ts(45,24): error TS1011: An element access expr // not legal var t5 = new new Date; ~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'Date' has no construct signatures. // Can be an expression new String; + // Error on union + declare const union: { a: string } | { b: string } + new union; + ~~~~~~~~~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: No constituent of type '{ a: string; } | { b: string; }' is constructable. + + // Error on union with one constructor + declare const ctorUnion: { a: string } | (new (a: string) => void) + new ctorUnion(""); + ~~~~~~~~~~~~~~~~~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Not all constituents of type '{ a: string; } | (new (a: string) => void)' are constructable. +!!! error TS2351: Type '{ a: string; }' has no construct signatures. + + // Error on union with incompatible constructors + declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) + new ctorUnion2(""); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. module M { export class T { diff --git a/tests/baselines/reference/newOperator.js b/tests/baselines/reference/newOperator.js index 160d385c0634b..1c4756399caf6 100644 --- a/tests/baselines/reference/newOperator.js +++ b/tests/baselines/reference/newOperator.js @@ -34,6 +34,17 @@ var t5 = new new Date; // Can be an expression new String; +// Error on union +declare const union: { a: string } | { b: string } +new union; + +// Error on union with one constructor +declare const ctorUnion: { a: string } | (new (a: string) => void) +new ctorUnion(""); + +// Error on union with incompatible constructors +declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) +new ctorUnion2(""); module M { export class T { @@ -69,6 +80,9 @@ var f = new q(); var t5 = new new Date; // Can be an expression new String; +new union; +new ctorUnion(""); +new ctorUnion2(""); var M; (function (M) { var T = /** @class */ (function () { diff --git a/tests/baselines/reference/newOperator.symbols b/tests/baselines/reference/newOperator.symbols index 33f9ea636828c..4578004151231 100644 --- a/tests/baselines/reference/newOperator.symbols +++ b/tests/baselines/reference/newOperator.symbols @@ -57,30 +57,59 @@ var t5 = new new Date; new String; >String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +// Error on union +declare const union: { a: string } | { b: string } +>union : Symbol(union, Decl(newOperator.ts, 36, 13)) +>a : Symbol(a, Decl(newOperator.ts, 36, 22)) +>b : Symbol(b, Decl(newOperator.ts, 36, 38)) + +new union; +>union : Symbol(union, Decl(newOperator.ts, 36, 13)) + +// Error on union with one constructor +declare const ctorUnion: { a: string } | (new (a: string) => void) +>ctorUnion : Symbol(ctorUnion, Decl(newOperator.ts, 40, 13)) +>a : Symbol(a, Decl(newOperator.ts, 40, 26)) +>a : Symbol(a, Decl(newOperator.ts, 40, 47)) + +new ctorUnion(""); +>ctorUnion : Symbol(ctorUnion, Decl(newOperator.ts, 40, 13)) + +// Error on union with incompatible constructors +declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) +>ctorUnion2 : Symbol(ctorUnion2, Decl(newOperator.ts, 44, 13)) +>T : Symbol(T, Decl(newOperator.ts, 44, 32)) +>a : Symbol(a, Decl(newOperator.ts, 44, 50)) +>T : Symbol(T, Decl(newOperator.ts, 44, 32)) +>T : Symbol(T, Decl(newOperator.ts, 44, 73)) +>a : Symbol(a, Decl(newOperator.ts, 44, 76)) + +new ctorUnion2(""); +>ctorUnion2 : Symbol(ctorUnion2, Decl(newOperator.ts, 44, 13)) module M { ->M : Symbol(M, Decl(newOperator.ts, 33, 11)) +>M : Symbol(M, Decl(newOperator.ts, 45, 19)) export class T { ->T : Symbol(T, Decl(newOperator.ts, 36, 10)) +>T : Symbol(T, Decl(newOperator.ts, 47, 10)) x: number; ->x : Symbol(T.x, Decl(newOperator.ts, 37, 20)) +>x : Symbol(T.x, Decl(newOperator.ts, 48, 20)) } } class S { ->S : Symbol(S, Decl(newOperator.ts, 40, 1)) +>S : Symbol(S, Decl(newOperator.ts, 51, 1)) public get xs(): M.T[] { ->xs : Symbol(S.xs, Decl(newOperator.ts, 42, 9)) ->M : Symbol(M, Decl(newOperator.ts, 33, 11)) ->T : Symbol(M.T, Decl(newOperator.ts, 36, 10)) +>xs : Symbol(S.xs, Decl(newOperator.ts, 53, 9)) +>M : Symbol(M, Decl(newOperator.ts, 45, 19)) +>T : Symbol(M.T, Decl(newOperator.ts, 47, 10)) return new M.T[]; ->M.T : Symbol(M.T, Decl(newOperator.ts, 36, 10)) ->M : Symbol(M, Decl(newOperator.ts, 33, 11)) ->T : Symbol(M.T, Decl(newOperator.ts, 36, 10)) +>M.T : Symbol(M.T, Decl(newOperator.ts, 47, 10)) +>M : Symbol(M, Decl(newOperator.ts, 45, 19)) +>T : Symbol(M.T, Decl(newOperator.ts, 47, 10)) } } diff --git a/tests/baselines/reference/newOperator.types b/tests/baselines/reference/newOperator.types index 2d8f25251616f..86bec09b895bd 100644 --- a/tests/baselines/reference/newOperator.types +++ b/tests/baselines/reference/newOperator.types @@ -84,6 +84,37 @@ new String; >new String : String >String : StringConstructor +// Error on union +declare const union: { a: string } | { b: string } +>union : { a: string; } | { b: string; } +>a : string +>b : string + +new union; +>new union : any +>union : { a: string; } | { b: string; } + +// Error on union with one constructor +declare const ctorUnion: { a: string } | (new (a: string) => void) +>ctorUnion : { a: string; } | (new (a: string) => void) +>a : string +>a : string + +new ctorUnion(""); +>new ctorUnion("") : any +>ctorUnion : { a: string; } | (new (a: string) => void) +>"" : "" + +// Error on union with incompatible constructors +declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) +>ctorUnion2 : (new (a: T) => void) | (new (a: string) => void) +>a : T +>a : string + +new ctorUnion2(""); +>new ctorUnion2("") : any +>ctorUnion2 : (new (a: T) => void) | (new (a: string) => void) +>"" : "" module M { >M : typeof M diff --git a/tests/baselines/reference/objectSpreadNegative.errors.txt b/tests/baselines/reference/objectSpreadNegative.errors.txt index bb064283a7bda..e0b24643241da 100644 --- a/tests/baselines/reference/objectSpreadNegative.errors.txt +++ b/tests/baselines/reference/objectSpreadNegative.errors.txt @@ -10,7 +10,8 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(33,19): error TS269 tests/cases/conformance/types/spread/objectSpreadNegative.ts(34,20): error TS2698: Spread types may only be created from object types. tests/cases/conformance/types/spread/objectSpreadNegative.ts(36,20): error TS2698: Spread types may only be created from object types. tests/cases/conformance/types/spread/objectSpreadNegative.ts(38,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(43,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(43,1): error TS2349: This expression is not callable. + Type '{}' has no call signatures. tests/cases/conformance/types/spread/objectSpreadNegative.ts(47,1): error TS2322: Type '12' is not assignable to type 'undefined'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(53,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,11): error TS2339: Property 'a' does not exist on type '{}'. @@ -86,7 +87,8 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,11): error TS233 let spreadFunc = { ...function () { } } spreadFunc(); // error, no call signature ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. // write-only properties get skipped let setterOnly = { ...{ set b (bad: number) { } } }; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt index bd39249289984..bbb1f4b2ea55e 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt +++ b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(6,27): error TS2314: Generic type 'abc' requires 1 type argument(s). -tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: This expression is not constructable. + Type 'typeof xyz' has no construct signatures. ==== tests/cases/compiler/recursiveBaseConstructorCreation3.ts (2 errors) ==== @@ -15,5 +16,6 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: C var bar = new xyz(); // Error: Invalid 'new' expression. ~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'typeof xyz' has no construct signatures. var r: xyz = bar.foo; \ No newline at end of file diff --git a/tests/baselines/reference/staticMemberExportAccess.errors.txt b/tests/baselines/reference/staticMemberExportAccess.errors.txt index 71fe50d4809bc..3da3171c8f159 100644 --- a/tests/baselines/reference/staticMemberExportAccess.errors.txt +++ b/tests/baselines/reference/staticMemberExportAccess.errors.txt @@ -1,4 +1,5 @@ -tests/cases/compiler/staticMemberExportAccess.ts(14,35): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/staticMemberExportAccess.ts(14,35): error TS2351: This expression is not constructable. + Type 'Sammy' has no construct signatures. tests/cases/compiler/staticMemberExportAccess.ts(17,18): error TS2576: Property 'bar' is a static member of type 'Sammy' tests/cases/compiler/staticMemberExportAccess.ts(18,18): error TS2339: Property 'x' does not exist on type 'Sammy'. @@ -19,7 +20,8 @@ tests/cases/compiler/staticMemberExportAccess.ts(18,18): error TS2339: Property var $: JQueryStatic; var instanceOfClassSammy: Sammy = new $.sammy(); // should be error ~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'Sammy' has no construct signatures. var r1 = instanceOfClassSammy.foo(); // r1 is string var r2 = $.sammy.foo(); var r3 = $.sammy.bar(); // error diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 6ddfbe328746a..4d55ee6b22e39 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -35,7 +35,8 @@ tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1212: Identifier tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2503: Cannot find namespace 'interface'. tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2552: Cannot find name 'ublic'. Did you mean 'public'? 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. Type 'String' has no compatible call signatures. +tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: This expression is not callable. + Type 'String' has no call signatures. ==== tests/cases/compiler/strictModeReservedWord.ts (38 errors) ==== @@ -139,7 +140,8 @@ 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. Type 'String' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no 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 040f6c6435c1f..5142ccdcebd7f 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt +++ b/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts(9,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(9,43): error TS2349: This expression is not callable. + Type 'Number' has no call signatures. ==== tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping2.ts (1 errors) ==== @@ -12,5 +13,6 @@ 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. Type 'Number' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'Number' has no call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/superNewCall1.errors.txt b/tests/baselines/reference/superNewCall1.errors.txt index 3ec370518c481..27e179d4a4055 100644 --- a/tests/baselines/reference/superNewCall1.errors.txt +++ b/tests/baselines/reference/superNewCall1.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/superNewCall1.ts(8,5): error TS2377: Constructors for derived classes must contain a 'super' call. -tests/cases/compiler/superNewCall1.ts(9,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/superNewCall1.ts(9,9): error TS2351: This expression is not constructable. + Type 'A' has no construct signatures. tests/cases/compiler/superNewCall1.ts(9,13): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. @@ -16,7 +17,8 @@ tests/cases/compiler/superNewCall1.ts(9,13): error TS17011: 'super' must be call new super(value => String(value)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'A' has no construct signatures. ~~~~~ !!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. } diff --git a/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt b/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt index 9815338f2efe5..2b51a74525e21 100644 --- a/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt +++ b/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts(3,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof CtorTag' has no compatible call signatures. +tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts(3,1): error TS2349: This expression is not callable. + Type 'typeof CtorTag' has no call signatures. ==== tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts (1 errors) ==== @@ -6,4 +7,5 @@ tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts(3, CtorTag `Hello world!`; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof CtorTag' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof CtorTag' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt b/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt index f3946d5a4f23d..3a502a288a647 100644 --- a/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt +++ b/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts(6,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'I' has no compatible call signatures. +tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts(6,1): error TS2349: This expression is not callable. + Type 'I' has no call signatures. ==== tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts (1 errors) ==== @@ -9,4 +10,5 @@ tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts(6, var tag: I; tag `Hello world!`; ~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'I' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'I' has no 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 cd5e2ff7c635a..29a80ff966eab 100644 --- a/tests/baselines/reference/templateStringInCallExpression.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpression.errors.txt @@ -1,7 +1,9 @@ -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,1): error TS2349: This expression is not callable. + Type 'String' has no 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. Type 'String' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no 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 fd47a8001adfe..32d9240681f02 100644 --- a/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt @@ -1,7 +1,9 @@ -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,1): error TS2349: This expression is not callable. + Type 'String' has no 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. Type 'String' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewExpression.errors.txt b/tests/baselines/reference/templateStringInNewExpression.errors.txt index 00ae3a6e4a25b..fbe4f67fc8c9d 100644 --- a/tests/baselines/reference/templateStringInNewExpression.errors.txt +++ b/tests/baselines/reference/templateStringInNewExpression.errors.txt @@ -1,7 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewExpression.ts(1,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/es6/templates/templateStringInNewExpression.ts(1,1): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewExpression.ts (1 errors) ==== new `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt b/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt index 3170afc98bf1e..bcbd8e9927c75 100644 --- a/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt @@ -1,7 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts(1,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts(1,1): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts (1 errors) ==== new `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewOperator.errors.txt b/tests/baselines/reference/templateStringInNewOperator.errors.txt index eed7415e5d25e..17043882c3674 100644 --- a/tests/baselines/reference/templateStringInNewOperator.errors.txt +++ b/tests/baselines/reference/templateStringInNewOperator.errors.txt @@ -1,7 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewOperator.ts(1,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/es6/templates/templateStringInNewOperator.ts(1,9): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewOperator.ts (1 errors) ==== var x = new `abc${ 1 }def`; ~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt b/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt index f4363d9ff2056..3ee887edf3923 100644 --- a/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt +++ b/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt @@ -1,7 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts(1,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts(1,9): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts (1 errors) ==== var x = new `abc${ 1 }def`; ~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt index 234ccfdcae502..8863b52ccb21c 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{ a: string; }' has no 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 +13,8 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): err ~~~~~~~~~~~~~~~~~~~~~~~~ `b`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{ a: string; }' has no call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt index 4c78dbea2cb6e..028488f414d40 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{ a: string; }' has no 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 +13,8 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(4,1): ~~~~~~~~~~~~~~~~~~~~~~~~ `b`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ a: string; }' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{ a: string; }' has no call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName1.errors.txt b/tests/baselines/reference/templateStringInPropertyName1.errors.txt index 15f4415611ba9..39c694532a7a1 100644 --- a/tests/baselines/reference/templateStringInPropertyName1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName1.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{}' has no 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 +11,8 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(3,1): err ~ `a`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName2.errors.txt b/tests/baselines/reference/templateStringInPropertyName2.errors.txt index d9e5d73dd060b..40206f0e9ea0b 100644 --- a/tests/baselines/reference/templateStringInPropertyName2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName2.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{}' has no 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 +11,8 @@ 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. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no 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 620b32485581d..6fbd787c7dc68 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{}' has no 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 +11,8 @@ tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(3,1): ~ `a`: 321 ~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no 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 00ef4e511bcb5..f1908f7498d22 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt @@ -1,4 +1,5 @@ -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(1,9): error TS2349: This expression is not callable. + Type '{}' has no 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 +11,8 @@ 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. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. ~~~~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 9494f03a8bf2a..3a527b6118371 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -1,7 +1,9 @@ -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,1): error TS2349: This expression is not callable. + Type 'String' has no 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. Type 'String' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no 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 581e084e7381e..142cd05bbcc31 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt @@ -1,7 +1,9 @@ -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,1): error TS2349: This expression is not callable. + Type 'String' has no 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. Type 'String' has no compatible call signatures. \ No newline at end of file +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt index e9dfb5ba3cd4b..fea09e516748a 100644 --- a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt +++ b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(1,19): error TS2313: Type parameter 'T' has a circular constraint. tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(4,19): error TS2339: Property 'foo' does not exist on type 'T'. -tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(5,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(5,17): error TS2351: This expression is not constructable. + Type '{}' has no construct signatures. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS2349: This expression is not callable. + Type '{}' has no call signatures. ==== tests/cases/compiler/typeParameterWithInvalidConstraintType.ts (4 errors) ==== @@ -15,10 +17,12 @@ tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS23 !!! error TS2339: Property 'foo' does not exist on type 'T'. var b = new x(123); ~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type '{}' has no construct signatures. var c = x[1]; var d = x(); ~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. } } \ No newline at end of file diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt index e7f5fc99136bd..3722fcadaa344 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt @@ -3,7 +3,8 @@ 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'. Type 'C' is missing the following properties from type 'Function': apply, call, bind -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(18,10): error TS2349: This expression is not callable. + Type 'C' has no 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,12): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(35,4): error TS2558: Expected 0 type arguments, but got 1. @@ -39,7 +40,8 @@ tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(41,4): error TS2 var c2: C; var r4 = c2(); // should be an error ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures. +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'C' has no call signatures. class C2 extends Function { } // error var c3: C2; diff --git a/tests/cases/compiler/newOperator.ts b/tests/cases/compiler/newOperator.ts index 1d7813400c7c4..6bb28daabb1c8 100644 --- a/tests/cases/compiler/newOperator.ts +++ b/tests/cases/compiler/newOperator.ts @@ -33,6 +33,17 @@ var t5 = new new Date; // Can be an expression new String; +// Error on union +declare const union: { a: string } | { b: string } +new union; + +// Error on union with one constructor +declare const ctorUnion: { a: string } | (new (a: string) => void) +new ctorUnion(""); + +// Error on union with incompatible constructors +declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) +new ctorUnion2(""); module M { export class T { From bc07eec015af8dfe0a14b77a07ecc5110461d02e Mon Sep 17 00:00:00 2001 From: Titian Cernicova-Dragomir Date: Sat, 22 Jun 2019 03:11:14 +0300 Subject: [PATCH 2/3] Added tests for new error messages on calls to unions. --- src/compiler/checker.ts | 2 +- .../betterErrorForUnionCall.errors.txt | 29 +++++++++++++++++ .../reference/betterErrorForUnionCall.js | 15 +++++++++ .../reference/betterErrorForUnionCall.symbols | 28 +++++++++++++++++ .../reference/betterErrorForUnionCall.types | 31 +++++++++++++++++++ .../cases/compiler/betterErrorForUnionCall.ts | 8 +++++ 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/betterErrorForUnionCall.errors.txt create mode 100644 tests/baselines/reference/betterErrorForUnionCall.js create mode 100644 tests/baselines/reference/betterErrorForUnionCall.symbols create mode 100644 tests/baselines/reference/betterErrorForUnionCall.types create mode 100644 tests/cases/compiler/betterErrorForUnionCall.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cd90880654ce3..c2317f0d8fb0c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22090,7 +22090,7 @@ namespace ts { ); } function invocationError(node: Node, apparentType: Type, kind: SignatureKind, relatedInformation?: DiagnosticRelatedInformation) { - const diagnostic: Diagnostic = createDiagnosticForNodeFromMessageChain(node, invocationErrorDetails(apparentType, kind)); + const diagnostic = createDiagnosticForNodeFromMessageChain(node, invocationErrorDetails(apparentType, kind)); diagnostics.add(diagnostic); invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic); } diff --git a/tests/baselines/reference/betterErrorForUnionCall.errors.txt b/tests/baselines/reference/betterErrorForUnionCall.errors.txt new file mode 100644 index 0000000000000..e9220dd99ca47 --- /dev/null +++ b/tests/baselines/reference/betterErrorForUnionCall.errors.txt @@ -0,0 +1,29 @@ +tests/cases/compiler/betterErrorForUnionCall.ts(2,1): error TS2349: This expression is not callable. + No constituent of type '{ a: string; } | { b: string; }' is callable. +tests/cases/compiler/betterErrorForUnionCall.ts(5,1): error TS2349: This expression is not callable. + Not all constituents of type '{ a: string; } | ((a: string) => void)' are callable. + Type '{ a: string; }' has no call signatures. +tests/cases/compiler/betterErrorForUnionCall.ts(8,1): error TS2349: This expression is not callable. + Each member of the union type '((a: T) => void) | ((a: string) => void)' has signatures, but none of those signatures are compatible with each other. + + +==== tests/cases/compiler/betterErrorForUnionCall.ts (3 errors) ==== + declare const union: { a: string } | { b: string } + union(""); + ~~~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: No constituent of type '{ a: string; } | { b: string; }' is callable. + + declare const fnUnion: { a: string } | ((a: string) => void) + fnUnion(""); + ~~~~~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Not all constituents of type '{ a: string; } | ((a: string) => void)' are callable. +!!! error TS2349: Type '{ a: string; }' has no call signatures. + + declare const fnUnion2: ((a: T) => void) | ((a: string) => void) + fnUnion2(""); + ~~~~~~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Each member of the union type '((a: T) => void) | ((a: string) => void)' has signatures, but none of those signatures are compatible with each other. + \ No newline at end of file diff --git a/tests/baselines/reference/betterErrorForUnionCall.js b/tests/baselines/reference/betterErrorForUnionCall.js new file mode 100644 index 0000000000000..5386599113602 --- /dev/null +++ b/tests/baselines/reference/betterErrorForUnionCall.js @@ -0,0 +1,15 @@ +//// [betterErrorForUnionCall.ts] +declare const union: { a: string } | { b: string } +union(""); + +declare const fnUnion: { a: string } | ((a: string) => void) +fnUnion(""); + +declare const fnUnion2: ((a: T) => void) | ((a: string) => void) +fnUnion2(""); + + +//// [betterErrorForUnionCall.js] +union(""); +fnUnion(""); +fnUnion2(""); diff --git a/tests/baselines/reference/betterErrorForUnionCall.symbols b/tests/baselines/reference/betterErrorForUnionCall.symbols new file mode 100644 index 0000000000000..1d28d3dae1305 --- /dev/null +++ b/tests/baselines/reference/betterErrorForUnionCall.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/betterErrorForUnionCall.ts === +declare const union: { a: string } | { b: string } +>union : Symbol(union, Decl(betterErrorForUnionCall.ts, 0, 13)) +>a : Symbol(a, Decl(betterErrorForUnionCall.ts, 0, 22)) +>b : Symbol(b, Decl(betterErrorForUnionCall.ts, 0, 38)) + +union(""); +>union : Symbol(union, Decl(betterErrorForUnionCall.ts, 0, 13)) + +declare const fnUnion: { a: string } | ((a: string) => void) +>fnUnion : Symbol(fnUnion, Decl(betterErrorForUnionCall.ts, 3, 13)) +>a : Symbol(a, Decl(betterErrorForUnionCall.ts, 3, 24)) +>a : Symbol(a, Decl(betterErrorForUnionCall.ts, 3, 41)) + +fnUnion(""); +>fnUnion : Symbol(fnUnion, Decl(betterErrorForUnionCall.ts, 3, 13)) + +declare const fnUnion2: ((a: T) => void) | ((a: string) => void) +>fnUnion2 : Symbol(fnUnion2, Decl(betterErrorForUnionCall.ts, 6, 13)) +>T : Symbol(T, Decl(betterErrorForUnionCall.ts, 6, 26)) +>a : Symbol(a, Decl(betterErrorForUnionCall.ts, 6, 44)) +>T : Symbol(T, Decl(betterErrorForUnionCall.ts, 6, 26)) +>T : Symbol(T, Decl(betterErrorForUnionCall.ts, 6, 63)) +>a : Symbol(a, Decl(betterErrorForUnionCall.ts, 6, 66)) + +fnUnion2(""); +>fnUnion2 : Symbol(fnUnion2, Decl(betterErrorForUnionCall.ts, 6, 13)) + diff --git a/tests/baselines/reference/betterErrorForUnionCall.types b/tests/baselines/reference/betterErrorForUnionCall.types new file mode 100644 index 0000000000000..0022cf369c4db --- /dev/null +++ b/tests/baselines/reference/betterErrorForUnionCall.types @@ -0,0 +1,31 @@ +=== tests/cases/compiler/betterErrorForUnionCall.ts === +declare const union: { a: string } | { b: string } +>union : { a: string; } | { b: string; } +>a : string +>b : string + +union(""); +>union("") : any +>union : { a: string; } | { b: string; } +>"" : "" + +declare const fnUnion: { a: string } | ((a: string) => void) +>fnUnion : { a: string; } | ((a: string) => void) +>a : string +>a : string + +fnUnion(""); +>fnUnion("") : any +>fnUnion : { a: string; } | ((a: string) => void) +>"" : "" + +declare const fnUnion2: ((a: T) => void) | ((a: string) => void) +>fnUnion2 : ((a: T) => void) | ((a: string) => void) +>a : T +>a : string + +fnUnion2(""); +>fnUnion2("") : any +>fnUnion2 : ((a: T) => void) | ((a: string) => void) +>"" : "" + diff --git a/tests/cases/compiler/betterErrorForUnionCall.ts b/tests/cases/compiler/betterErrorForUnionCall.ts new file mode 100644 index 0000000000000..6288e3a3e36b6 --- /dev/null +++ b/tests/cases/compiler/betterErrorForUnionCall.ts @@ -0,0 +1,8 @@ +declare const union: { a: string } | { b: string } +union(""); + +declare const fnUnion: { a: string } | ((a: string) => void) +fnUnion(""); + +declare const fnUnion2: ((a: T) => void) | ((a: string) => void) +fnUnion2(""); From e4bca9649a181dcfe9543e0073f9ef4431fd852f Mon Sep 17 00:00:00 2001 From: Titian Cernicova-Dragomir Date: Fri, 28 Jun 2019 23:23:21 +0300 Subject: [PATCH 3/3] Improved error spans for call errors: 1. When calling a non-callable expression the error span is on the call target not on the whole call 2. When calling a method, the error for overload resolution now includes the arguments (this was previously regressed by #31414) --- src/compiler/checker.ts | 73 ++++++++++++------- .../codefixes/fixInvalidImportSyntax.ts | 2 +- ...yErrorRelatedSpanBindingPattern.errors.txt | 4 +- .../baselines/reference/baseCheck.errors.txt | 2 +- .../betterErrorForAccidentalCall.errors.txt | 13 ++-- .../betterErrorForUnionCall.errors.txt | 6 +- ...dSameNameFunctionDeclarationES5.errors.txt | 2 +- ...dSameNameFunctionDeclarationES6.errors.txt | 2 +- ...ameFunctionDeclarationStrictES5.errors.txt | 4 +- ...ameFunctionDeclarationStrictES6.errors.txt | 4 +- .../reference/callOnInstance.errors.txt | 2 +- .../reference/callOverload.errors.txt | 2 +- .../reference/callWithMissingVoid.errors.txt | 22 +++--- ...assCanExtendConstructorFunction.errors.txt | 2 +- ...putedPropertiesInDestructuring1.errors.txt | 4 +- ...dPropertiesInDestructuring1_ES6.errors.txt | 4 +- ...constructableDecoratorOnClass01.errors.txt | 4 +- ...llingBaseImplWithOptionalParams.errors.txt | 2 +- .../exponentiationOperatorWithNew.errors.txt | 4 +- .../reference/functionCall11.errors.txt | 2 +- .../reference/functionCall12.errors.txt | 2 +- .../reference/functionCall13.errors.txt | 2 +- .../reference/functionCall16.errors.txt | 2 +- .../reference/functionCall17.errors.txt | 2 +- .../reference/functionCall18.errors.txt | 2 +- .../reference/functionCall6.errors.txt | 2 +- .../reference/functionCall7.errors.txt | 2 +- ...ctionExpressionShadowedByParams.errors.txt | 2 +- .../reference/functionOverloads29.errors.txt | 2 +- .../reference/functionOverloads34.errors.txt | 2 +- .../reference/functionOverloads37.errors.txt | 2 +- .../functionParameterArityMismatch.errors.txt | 10 +-- ...ericArrayAssignmentCompatErrors.errors.txt | 4 +- ...unctionsWithOptionalParameters2.errors.txt | 2 +- .../reference/genericRestArity.errors.txt | 2 +- .../genericRestArityStrict.errors.txt | 2 +- .../genericRestParameters3.errors.txt | 2 +- ...ropertiesInheritedIntoClassType.errors.txt | 8 +- .../instancePropertyInClassType.errors.txt | 8 +- .../reference/intTypeCheck.errors.txt | 48 ++++++------ .../iterableArrayPattern25.errors.txt | 2 +- ...leFunctionParametersAsOptional2.errors.txt | 6 +- .../jsdocTypeTagRequiredParameters.errors.txt | 6 +- .../reference/methodChainError.errors.txt | 23 ++++-- tests/baselines/reference/methodChainError.js | 17 ++++- .../reference/methodChainError.symbols | 32 ++++++-- .../reference/methodChainError.types | 33 ++++++++- ...ortWithExportPropertyAssignment.errors.txt | 2 +- .../narrowFromAnyWithTypePredicate.errors.txt | 2 +- .../reference/neverTypeErrors1.errors.txt | 2 +- .../reference/neverTypeErrors2.errors.txt | 2 +- .../reference/newAbstractInstance.errors.txt | 4 +- .../reference/newOnInstanceSymbol.errors.txt | 4 +- .../reference/newOperator.errors.txt | 24 +++--- .../reference/objectSpreadNegative.errors.txt | 2 +- .../optionalParamArgsTest.errors.txt | 16 ++-- .../baselines/reference/overload1.errors.txt | 2 +- ...loadsAndTypeArgumentArityErrors.errors.txt | 2 +- ...cursiveBaseConstructorCreation3.errors.txt | 4 +- .../requiredInitializedParameter1.errors.txt | 4 +- .../restParamsWithNonRestParams.errors.txt | 2 +- ...romGeneratorMakesRequiredParams.errors.txt | 2 +- .../staticMemberExportAccess.errors.txt | 4 +- .../reference/strictBindCallApply1.errors.txt | 6 +- .../strictModeReservedWord.errors.txt | 2 +- ...rCallParameterContextualTyping2.errors.txt | 2 +- .../reference/superNewCall1.errors.txt | 4 +- ...dTemplateWithConstructableTag01.errors.txt | 2 +- ...dTemplateWithConstructableTag02.errors.txt | 2 +- .../templateStringInCallExpression.errors.txt | 2 +- ...mplateStringInCallExpressionES6.errors.txt | 2 +- .../templateStringInNewExpression.errors.txt | 4 +- ...emplateStringInNewExpressionES6.errors.txt | 4 +- .../templateStringInNewOperator.errors.txt | 4 +- .../templateStringInNewOperatorES6.errors.txt | 4 +- .../templateStringInObjectLiteral.errors.txt | 3 +- ...emplateStringInObjectLiteralES6.errors.txt | 3 +- .../templateStringInPropertyName1.errors.txt | 3 +- .../templateStringInPropertyName2.errors.txt | 3 +- ...mplateStringInPropertyNameES6_1.errors.txt | 3 +- ...mplateStringInPropertyNameES6_2.errors.txt | 3 +- .../templateStringInTaggedTemplate.errors.txt | 2 +- ...mplateStringInTaggedTemplateES6.errors.txt | 2 +- .../thisTypeInFunctionsNegative.errors.txt | 10 +-- ...eAssertionToGenericFunctionType.errors.txt | 2 +- ...ameterWithInvalidConstraintType.errors.txt | 6 +- .../unionTypeCallSignatures.errors.txt | 28 +++---- .../unionTypeCallSignatures4.errors.txt | 2 +- ...unctionCallsWithTypeParameters1.errors.txt | 2 +- tests/cases/compiler/methodChainError.ts | 10 ++- 90 files changed, 338 insertions(+), 247 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c2317f0d8fb0c..3d2f1340a70c1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21298,8 +21298,34 @@ namespace ts { return Debug.fail(); } } + function getDiagnosticSpanForCallNode(node: CallExpression, doNotIncludeArguments?: boolean) { + let start: number; + let length: number; + const sourceFile = getSourceFileOfNode(node); - function getArgumentArityError(node: Node, signatures: ReadonlyArray, args: ReadonlyArray) { + if (isPropertyAccessExpression(node.expression)) { + const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name); + start = nameSpan.start; + length = doNotIncludeArguments ? nameSpan.length : node.end - start; + } + else { + const expressionSpan = getErrorSpanForNode(sourceFile, node.expression); + start = expressionSpan.start; + length = doNotIncludeArguments ? expressionSpan.length : node.end - start; + } + return { start, length, sourceFile }; + } + function getDiagnosticForCallNode(node: CallLikeExpression, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation { + if (isCallExpression(node)) { + const { sourceFile, start, length } = getDiagnosticSpanForCallNode(node); + return createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2, arg3); + } + else { + return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3); + } + } + + function getArgumentArityError(node: CallLikeExpression, signatures: ReadonlyArray, args: ReadonlyArray) { let min = Number.POSITIVE_INFINITY; let max = Number.NEGATIVE_INFINITY; let belowArgCount = Number.NEGATIVE_INFINITY; @@ -21346,11 +21372,11 @@ namespace ts { } } if (min < argCount && argCount < max) { - return createDiagnosticForNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount); + return getDiagnosticForCallNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount); } if (!hasSpreadArgument && argCount < min) { - const diagnostic = createDiagnosticForNode(node, error, paramRange, argCount); + const diagnostic = getDiagnosticForCallNode(node, error, paramRange, argCount); return related ? addRelatedInfo(diagnostic, related) : diagnostic; } @@ -21425,8 +21451,7 @@ namespace ts { reorderCandidates(signatures, candidates); if (!candidates.length) { if (reportErrors) { - const errorNode = getCallErrorNode(node); - diagnostics.add(createDiagnosticForNode(errorNode, Diagnostics.Call_target_does_not_contain_any_signatures)); + diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures)); } return resolveErrorCall(node); } @@ -21504,13 +21529,12 @@ namespace ts { // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (reportErrors) { - const errorNode = getCallErrorNode(node); if (candidateForArgumentError) { checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, CheckMode.Normal, /*reportErrors*/ true); } else if (candidateForArgumentArityError) { - diagnostics.add(getArgumentArityError(errorNode, [candidateForArgumentArityError], args)); + diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args)); } else if (candidateForTypeArgumentError) { checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, fallbackError); @@ -21518,31 +21542,19 @@ namespace ts { else { const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments)); if (signaturesWithCorrectTypeArgumentArity.length === 0) { - diagnostics.add(getTypeArgumentArityError(errorNode, signatures, typeArguments!)); + diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!)); } else if (!isDecorator) { - diagnostics.add(getArgumentArityError(errorNode, signaturesWithCorrectTypeArgumentArity, args)); + diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args)); } else if (fallbackError) { - diagnostics.add(createDiagnosticForNode(errorNode, fallbackError)); + diagnostics.add(getDiagnosticForCallNode(node, fallbackError)); } } } return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); - function getCallErrorNode(node: CallLikeExpression): Node { - if (isCallExpression(node)) { - if (isPropertyAccessExpression(node.expression)) { - return node.expression.name; - } - else { - return node.expression; - } - } - return node; - } - function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) { candidateForArgumentError = undefined; candidateForArgumentArityError = undefined; @@ -21825,7 +21837,7 @@ namespace ts { relatedInformation = createDiagnosticForNode(node.expression, Diagnostics.It_is_highly_likely_that_you_are_missing_a_semicolon); } } - invocationError(node, apparentType, SignatureKind.Call, relatedInformation); + invocationError(node.expression, apparentType, SignatureKind.Call, relatedInformation); } return resolveErrorCall(node); } @@ -21942,7 +21954,7 @@ namespace ts { return signature; } - invocationError(node, expressionType, SignatureKind.Construct); + invocationError(node.expression, expressionType, SignatureKind.Construct); return resolveErrorCall(node); } @@ -22089,8 +22101,13 @@ namespace ts { Diagnostics.This_expression_is_not_constructable ); } - function invocationError(node: Node, apparentType: Type, kind: SignatureKind, relatedInformation?: DiagnosticRelatedInformation) { - const diagnostic = createDiagnosticForNodeFromMessageChain(node, invocationErrorDetails(apparentType, kind)); + function invocationError(errorTarget: Node, apparentType: Type, kind: SignatureKind, relatedInformation?: DiagnosticRelatedInformation) { + const diagnostic = createDiagnosticForNodeFromMessageChain(errorTarget, invocationErrorDetails(apparentType, kind)); + if (isCallExpression(errorTarget.parent)) { + const { start, length } = getDiagnosticSpanForCallNode(errorTarget.parent, /* doNotIncludeArguments */ true); + diagnostic.start = start; + diagnostic.length = length; + } diagnostics.add(diagnostic); invocationErrorRecovery(apparentType, kind, relatedInformation ? addRelatedInfo(diagnostic, relatedInformation) : diagnostic); } @@ -22129,7 +22146,7 @@ namespace ts { } if (!callSignatures.length) { - invocationError(node, apparentType, SignatureKind.Call); + invocationError(node.tag, apparentType, SignatureKind.Call); return resolveErrorCall(node); } @@ -22187,7 +22204,7 @@ namespace ts { if (!callSignatures.length) { let errorInfo = invocationErrorDetails(apparentType, SignatureKind.Call); errorInfo = chainDiagnosticMessages(errorInfo, headMessage); - const diag = createDiagnosticForNodeFromMessageChain(node, errorInfo); + const diag = createDiagnosticForNodeFromMessageChain(node.expression, errorInfo); diagnostics.add(diag); invocationErrorRecovery(apparentType, SignatureKind.Call, diag); return resolveErrorCall(node); diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 4ef030d62e5a7..dc37aeff12b33 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -40,7 +40,7 @@ namespace ts.codefix { function getActionsForUsageOfInvalidImport(context: CodeFixContext): CodeFixAction[] | undefined { const sourceFile = context.sourceFile; const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? SyntaxKind.CallExpression : SyntaxKind.NewExpression; - const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), a => a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length)) as CallExpression | NewExpression; + const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), a => a.kind === targetKind) as CallExpression | NewExpression; if (!node) { return []; } diff --git a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt index 3ebaaa1004f4b..788ff30c58f83 100644 --- a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt +++ b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt @@ -8,12 +8,12 @@ tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts(7,1): error TS2554: function bar(a, b, [c]): void {} foo("", 0); - ~~~ + ~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:1:20: An argument matching this binding pattern was not provided. bar("", 0); - ~~~ + ~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:3:20: An argument matching this binding pattern was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index 359d689e3feb7..67358a1033834 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -30,7 +30,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. } class D extends C { constructor(public z: number) { super(this.z) } } // too few params - ~~~~~ + ~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided. ~~~~ diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt index 5c67734b34c5a..46b359017e0bd 100644 --- a/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt +++ b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt @@ -14,36 +14,33 @@ tests/cases/compiler/betterErrorForAccidentalCall.ts(13,1): error TS2349: This e declare function foo(): string; foo()(1 as number).toString(); - ~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. foo() (1 as number).toString(); - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. foo() ~~~~~ - (1 as number).toString(); - ~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:7:1: It is highly likely that you are missing a semicolon. + (1 as number).toString(); foo() ~~~~~ - (1 + 2).toString(); - ~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:10:1: It is highly likely that you are missing a semicolon. + (1 + 2).toString(); foo() ~~~~~ - (1).toString(); - ~~~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. !!! related TS2734 tests/cases/compiler/betterErrorForAccidentalCall.ts:13:1: It is highly likely that you are missing a semicolon. + (1).toString(); \ No newline at end of file diff --git a/tests/baselines/reference/betterErrorForUnionCall.errors.txt b/tests/baselines/reference/betterErrorForUnionCall.errors.txt index e9220dd99ca47..2f37fccb16850 100644 --- a/tests/baselines/reference/betterErrorForUnionCall.errors.txt +++ b/tests/baselines/reference/betterErrorForUnionCall.errors.txt @@ -10,20 +10,20 @@ tests/cases/compiler/betterErrorForUnionCall.ts(8,1): error TS2349: This express ==== tests/cases/compiler/betterErrorForUnionCall.ts (3 errors) ==== declare const union: { a: string } | { b: string } union(""); - ~~~~~~~~~ + ~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: No constituent of type '{ a: string; } | { b: string; }' is callable. declare const fnUnion: { a: string } | ((a: string) => void) fnUnion(""); - ~~~~~~~~~~~ + ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Not all constituents of type '{ a: string; } | ((a: string) => void)' are callable. !!! error TS2349: Type '{ a: string; }' has no call signatures. declare const fnUnion2: ((a: T) => void) | ((a: string) => void) fnUnion2(""); - ~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Each member of the union type '((a: T) => void) | ((a: string) => void)' has signatures, but none of those signatures are compatible with each other. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt index 96d23c6a30485..407c1c22a3734 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt @@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T } foo(10); foo(); // not ok - needs number - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt index da0e50d3086e0..0a6109ee05f3d 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt @@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T } foo(10); foo(); // not ok - needs number - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt index c8c98c5191708..b6c4ac4c6a588 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt @@ -29,12 +29,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e } foo(10); foo(); // not ok - needs number - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. } foo(10); foo(); // not ok - needs number - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt index 963b849ee7206..d9b81d2686f20 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt @@ -23,12 +23,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): e } foo(10); foo(); // not ok - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided. } foo(10); foo(); // not ok - needs number - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/callOnInstance.errors.txt b/tests/baselines/reference/callOnInstance.errors.txt index 7b6010df12aaf..62abe6fd1e096 100644 --- a/tests/baselines/reference/callOnInstance.errors.txt +++ b/tests/baselines/reference/callOnInstance.errors.txt @@ -22,6 +22,6 @@ tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: This expression is n declare class C { constructor(value: number); } (new C(1))(); // Error for calling an instance - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'C' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/callOverload.errors.txt b/tests/baselines/reference/callOverload.errors.txt index b08bf7ce8910c..0f6a2ade085a0 100644 --- a/tests/baselines/reference/callOverload.errors.txt +++ b/tests/baselines/reference/callOverload.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/expressions/functionCalls/callOverload.ts(11,10): error !!! error TS2554: Expected 2 arguments, but got 4. withRest('a', ...n); // no error withRest(); - ~~~~~~~~ + ~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callOverload.ts:3:27: An argument for 'a' was not provided. withRest(...n); diff --git a/tests/baselines/reference/callWithMissingVoid.errors.txt b/tests/baselines/reference/callWithMissingVoid.errors.txt index 8b38f53acd4ae..45a66c7a81e89 100644 --- a/tests/baselines/reference/callWithMissingVoid.errors.txt +++ b/tests/baselines/reference/callWithMissingVoid.errors.txt @@ -28,19 +28,19 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): declare const xAny: X; xAny.f() // error, any still expects an argument - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. declare const xUnknown: X; xUnknown.f() // error, unknown still expects an argument - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. declare const xNever: X; xNever.f() // error, never still expects an argument - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. @@ -56,15 +56,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): new MyPromise(resolve => resolve()); // no error new MyPromise(resolve => resolve()); // no error new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted - ~~~~~~~ + ~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. new MyPromise(resolve => resolve()); // error, `unknown` arguments cannot be omitted - ~~~~~~~ + ~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. new MyPromise(resolve => resolve()); // error, `never` arguments cannot be omitted - ~~~~~~~ + ~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. @@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): a(4, "hello"); // ok a(4, "hello", void 0); // ok a(4); // not ok - ~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:42:23: An argument for 'y' was not provided. @@ -88,15 +88,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): b(4, "hello", void 0, 2); // ok b(4, "hello"); // not ok - ~ + ~~~~~~~~~~~~~ !!! error TS2554: Expected 4 arguments, but got 2. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:34: An argument for 'z' was not provided. b(4, "hello", void 0); // not ok - ~ + ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 4 arguments, but got 3. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:43: An argument for 'what' was not provided. b(4); // not ok - ~ + ~~~~ !!! error TS2554: Expected 4 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:23: An argument for 'y' was not provided. @@ -117,7 +117,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): ...args: TS): void; call((x: number, y: number) => x + y) // error - ~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:73:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 4, 2) // ok diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt index 26b83dc08a6da..02c5940be143e 100644 --- a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt +++ b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt @@ -38,7 +38,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type ' class Sql extends Wagon { constructor() { super(); // error: not enough arguments - ~~~~~ + ~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/salsa/first.js:5:16: An argument for 'numberOxen' was not provided. this.foonly = 12 diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt index 3cdab34055c30..3ae6989781860 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.errors.txt @@ -59,7 +59,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: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. ~~~~~ @@ -89,7 +89,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: !!! error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. [{[foo()]: bar4}] = [{bar: "bar"}]; - ~~~~~ + ~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. ~~~~~ diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt index 867b0ca7a450d..0e4ac5c8aefc5 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertiesInDestructuring1_ES6.errors.txt @@ -60,7 +60,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: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. ~~~~~ @@ -90,7 +90,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS23 !!! error TS2537: Type '{ bar: string; }' has no matching index signature for type 'string'. [{[foo()]: bar4}] = [{bar: "bar"}]; - ~~~~~ + ~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. ~~~~~ diff --git a/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt b/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt index 742bfc7cfbf70..43c94f1a0efd6 100644 --- a/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt +++ b/tests/baselines/reference/constructableDecoratorOnClass01.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. +tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts(3,2): error TS1238: Unable to resolve signature of class decorator when called as an expression. This expression is not callable. Type 'typeof CtorDtor' has no call signatures. @@ -7,7 +7,7 @@ tests/cases/conformance/decorators/class/constructableDecoratorOnClass01.ts(3,1) class CtorDtor {} @CtorDtor - ~~~~~~~~~ + ~~~~~~~~ !!! error TS1238: Unable to resolve signature of class decorator when called as an expression. !!! error TS1238: This expression is not callable. !!! error TS1238: Type 'typeof CtorDtor' has no call signatures. diff --git a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt index 54c58bd40b5b4..18f19455d2a7b 100644 --- a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt +++ b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt @@ -15,6 +15,6 @@ tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,3): erro var y: MyClass = new MyClass(); y.myMethod(); // error - ~~~~~~~~ + ~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts:5:14: An argument for 'myList' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt b/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt index 449af44e322cf..19c25b05df9a7 100644 --- a/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithNew.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew.ts(6,1): error TS2351: This expression is not constructable. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew.ts(6,5): error TS2351: This expression is not constructable. Type 'Number' has no construct signatures. @@ -9,6 +9,6 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNew new a ** b ** c; new a ** new b ** c; new (a ** b ** c); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'Number' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall11.errors.txt b/tests/baselines/reference/functionCall11.errors.txt index b35a38fd09906..4fb06f831570a 100644 --- a/tests/baselines/reference/functionCall11.errors.txt +++ b/tests/baselines/reference/functionCall11.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen foo('foo', 1); foo('foo'); foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall12.errors.txt b/tests/baselines/reference/functionCall12.errors.txt index 0221a9006b778..8b6c02b480499 100644 --- a/tests/baselines/reference/functionCall12.errors.txt +++ b/tests/baselines/reference/functionCall12.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3' foo('foo', 1); foo('foo'); foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall13.errors.txt b/tests/baselines/reference/functionCall13.errors.txt index 4717d04f2416f..8e7b5ecc97aa6 100644 --- a/tests/baselines/reference/functionCall13.errors.txt +++ b/tests/baselines/reference/functionCall13.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1' foo('foo', 1); foo('foo'); foo(); - ~~~ + ~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall16.errors.txt b/tests/baselines/reference/functionCall16.errors.txt index 15e67bb6b14fb..220e2017b67d2 100644 --- a/tests/baselines/reference/functionCall16.errors.txt +++ b/tests/baselines/reference/functionCall16.errors.txt @@ -11,7 +11,7 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1' foo('foo'); foo('foo', 'bar'); foo(); - ~~~ + ~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall17.errors.txt b/tests/baselines/reference/functionCall17.errors.txt index 8bb5a7e3e1726..5d1bfe98edd92 100644 --- a/tests/baselines/reference/functionCall17.errors.txt +++ b/tests/baselines/reference/functionCall17.errors.txt @@ -11,7 +11,7 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1' !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. foo('foo'); foo(); - ~~~ + ~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall18.errors.txt b/tests/baselines/reference/functionCall18.errors.txt index dfd0ab9af4fa5..1744c76982f83 100644 --- a/tests/baselines/reference/functionCall18.errors.txt +++ b/tests/baselines/reference/functionCall18.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionCall18.ts(4,1): error TS2554: Expected 2 arguments, declare function foo(a: T, b: T); declare function foo(a: {}); foo("hello"); - ~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/functionCall18.ts:2:31: An argument for 'b' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall6.errors.txt b/tests/baselines/reference/functionCall6.errors.txt index 585c12aa354f1..af3d4a0be22d5 100644 --- a/tests/baselines/reference/functionCall6.errors.txt +++ b/tests/baselines/reference/functionCall6.errors.txt @@ -13,7 +13,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments, ~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall6.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index 31d0eb320080b..53a3c575ec314 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -15,7 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments, ~ !!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'. foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall7.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt index a27810e9fc752..ed53cfbb0d5ef 100644 --- a/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt +++ b/tests/baselines/reference/functionExpressionShadowedByParams.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/functionExpressionShadowedByParams.ts(10,9): error TS2339: function b1(b1: number) { b1.toPrecision(2); // should not error b1(12); // should error - ~~~~~~ + ~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'Number' has no call signatures. } diff --git a/tests/baselines/reference/functionOverloads29.errors.txt b/tests/baselines/reference/functionOverloads29.errors.txt index 3f0fdea31b4d9..908380417f958 100644 --- a/tests/baselines/reference/functionOverloads29.errors.txt +++ b/tests/baselines/reference/functionOverloads29.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads29.ts(4,9): error TS2554: Expected 1 argum function foo(bar:number):number; function foo(bar:any):any{ return bar } var x = foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads29.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads34.errors.txt b/tests/baselines/reference/functionOverloads34.errors.txt index c83981b915940..1d032b7c34dd4 100644 --- a/tests/baselines/reference/functionOverloads34.errors.txt +++ b/tests/baselines/reference/functionOverloads34.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads34.ts(4,9): error TS2554: Expected 1 argum function foo(bar:{a:boolean;}):number; function foo(bar:{a:any;}):any{ return bar } var x = foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads34.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads37.errors.txt b/tests/baselines/reference/functionOverloads37.errors.txt index 7760944cd01f3..9f0ac5ee0e561 100644 --- a/tests/baselines/reference/functionOverloads37.errors.txt +++ b/tests/baselines/reference/functionOverloads37.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads37.ts(4,9): error TS2554: Expected 1 argum function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo(); - ~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads37.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionParameterArityMismatch.errors.txt b/tests/baselines/reference/functionParameterArityMismatch.errors.txt index 45533c6a3fa63..aa870c23028c2 100644 --- a/tests/baselines/reference/functionParameterArityMismatch.errors.txt +++ b/tests/baselines/reference/functionParameterArityMismatch.errors.txt @@ -11,11 +11,11 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp declare function f1(a: number); declare function f1(a: number, b: number, c: number); f1(); - ~~ + ~~~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionParameterArityMismatch.ts:1:21: An argument for 'a' was not provided. f1(1, 2); - ~~ + ~~~~~~~~ !!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments. f1(1, 2, 3, 4); ~ @@ -26,13 +26,13 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp declare function f2(a: number, b: number, c: number, d: number); declare function f2(a: number, b: number, c: number, d: number, e: number, f: number); f2(1); - ~~ + ~~~~~ !!! error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments. f2(1, 2, 3); - ~~ + ~~~~~~~~~~~ !!! error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments. f2(1, 2, 3, 4, 5); - ~~ + ~~~~~~~~~~~~~~~~~ !!! error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments. f2(1, 2, 3, 4, 5, 6, 7); ~ diff --git a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt index ac6b1df60b429..d5d6bc6980eb6 100644 --- a/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt +++ b/tests/baselines/reference/genericArrayAssignmentCompatErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(2,15): error TS2351: This expression is not constructable. +tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(2,19): error TS2351: This expression is not constructable. Type 'undefined[]' has no construct signatures. tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'Array' requires 1 type argument(s). @@ -6,7 +6,7 @@ tests/cases/compiler/genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: ==== tests/cases/compiler/genericArrayAssignmentCompatErrors.ts (2 errors) ==== var myCars=new Array(); var myCars2 = new []; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'undefined[]' has no construct signatures. var myCars3 = new Array({}); diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt index 9eb49dbf9bae0..fbeabdcaa481d 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt @@ -9,7 +9,7 @@ tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,7): error TS25 var utils: Utils; utils.fold(); // error - ~~~~ + ~~~~~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts:2:15: An argument for 'c' was not provided. utils.fold(null); // no error diff --git a/tests/baselines/reference/genericRestArity.errors.txt b/tests/baselines/reference/genericRestArity.errors.txt index 97889f68bd42e..e9c98c355843a 100644 --- a/tests/baselines/reference/genericRestArity.errors.txt +++ b/tests/baselines/reference/genericRestArity.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArity.ts(8,45): error TS2554: Expe ...args: TS): void; call((x: number, y: number) => x + y); - ~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/rest/genericRestArity.ts:5:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); diff --git a/tests/baselines/reference/genericRestArityStrict.errors.txt b/tests/baselines/reference/genericRestArityStrict.errors.txt index d91611ab494e4..c5fc4e9704f1d 100644 --- a/tests/baselines/reference/genericRestArityStrict.errors.txt +++ b/tests/baselines/reference/genericRestArityStrict.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,45): error TS2554 ...args: TS): void; call((x: number, y: number) => x + y); - ~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/rest/genericRestArityStrict.ts:5:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index 417338401e32d..612140ea9408f 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -87,7 +87,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345 declare function foo(cb: (...args: T) => void): void; foo>(); // Error - ~~~ + ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/rest/genericRestParameters3.ts:27:39: An argument for 'cb' was not provided. foo>(100); // Error diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index 4d9330d16ff33..3b39bdc8e78ea 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,10 +1,10 @@ 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: This expression is not callable. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,16): error TS2349: This expression is not callable. Type 'Number' has no 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: This expression is not callable. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,16): error TS2349: This expression is not callable. Type 'String' has no call signatures. @@ -32,7 +32,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn var r3 = r.y; r.y = 4; var r6 = d.y(); // error - ~~~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'Number' has no call signatures. @@ -61,7 +61,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIn var r3 = r.y; r.y = ''; var r6 = d.y(); // error - ~~~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no 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 65d72b91832b9..aa5f4eaa8d6eb 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,10 +1,10 @@ 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: This expression is not callable. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,16): error TS2349: This expression is not callable. Type 'Number' has no 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: This expression is not callable. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,16): error TS2349: This expression is not callable. Type 'String' has no call signatures. @@ -30,7 +30,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t var r3 = r.y; r.y = 4; var r6 = c.y(); // error - ~~~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'Number' has no call signatures. @@ -57,7 +57,7 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.t var r3 = r.y; r.y = ''; var r6 = c.y(); // error - ~~~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 2915e869095ca..2b4b8638cc953 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -3,14 +3,14 @@ tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/intTypeCheck.ts(99,5): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'i1': p, p3, p6 -tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(100,20): error TS2351: This expression is not constructable. Type 'i1' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(101,5): error TS2739: Type 'Base' is missing the following properties from type 'i1': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(103,5): error TS2739: Type '() => void' is missing the following properties from type 'i1': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(106,21): error TS2693: 'i1' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(107,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. Type '{}' provides no match for the signature '(): any'. @@ -23,7 +23,7 @@ tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not as tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(120,22): error TS2693: 'i2' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(121,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. Type '{}' provides no match for the signature 'new (): any'. @@ -37,26 +37,26 @@ tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(134,22): error TS2693: 'i3' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(135,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. -tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(142,21): error TS2351: This expression is not constructable. Type 'i4' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(148,22): error TS2693: 'i4' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(149,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(154,5): error TS2739: Type '{}' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(155,5): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'i5': p, p3, p6 -tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(156,21): error TS2351: This expression is not constructable. Type 'i5' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(157,5): error TS2739: Type 'Base' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(159,5): error TS2739: Type '() => void' is missing the following properties from type 'i5': p, p3, p6 tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(162,22): error TS2693: 'i5' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(163,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. Type '{}' provides no match for the signature '(): any'. @@ -71,7 +71,7 @@ tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(176,22): error TS2693: 'i6' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(177,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. Type '{}' provides no match for the signature 'new (): any'. @@ -85,14 +85,14 @@ tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(190,22): error TS2693: 'i7' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(191,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. -tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(198,21): error TS2351: This expression is not constructable. Type 'i8' has no construct signatures. tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(204,22): error TS2693: 'i8' only refers to a type, but is being used as a value here. -tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is not constructable. +tests/cases/compiler/intTypeCheck.ts(205,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. @@ -206,7 +206,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n !!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? !!! error TS2696: Type 'Object' is missing the following properties from type 'i1': p, p3, p6 var obj3: i1 = new obj0; - ~~~~~~~~ + ~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'i1' has no construct signatures. var obj4: i1 = new Base; @@ -226,7 +226,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i1' only refers to a type, but is being used as a value here. var obj10: i1 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -261,7 +261,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i2' only refers to a type, but is being used as a value here. var obj21: i2 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -297,7 +297,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i3' only refers to a type, but is being used as a value here. var obj32: i3 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -307,7 +307,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n var obj34: i4 = {}; var obj35: i4 = new Object(); var obj36: i4 = new obj33; - ~~~~~~~~~ + ~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'i4' has no construct signatures. var obj37: i4 = new Base; @@ -323,7 +323,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i4' only refers to a type, but is being used as a value here. var obj43: i4 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -338,7 +338,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n !!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? !!! error TS2696: Type 'Object' is missing the following properties from type 'i5': p, p3, p6 var obj47: i5 = new obj44; - ~~~~~~~~~ + ~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'i5' has no construct signatures. var obj48: i5 = new Base; @@ -358,7 +358,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i5' only refers to a type, but is being used as a value here. var obj54: i5 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -396,7 +396,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i6' only refers to a type, but is being used as a value here. var obj65: i6 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -432,7 +432,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i7' only refers to a type, but is being used as a value here. var obj76: i7 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. // @@ -442,7 +442,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n var obj78: i8 = {}; var obj79: i8 = new Object(); var obj80: i8 = new obj77; - ~~~~~~~~~ + ~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'i8' has no construct signatures. var obj81: i8 = new Base; @@ -458,6 +458,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: This expression is n ~~ !!! error TS2693: 'i8' only refers to a type, but is being used as a value here. var obj87: i8 = new {}; - ~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern25.errors.txt b/tests/baselines/reference/iterableArrayPattern25.errors.txt index d566c127e430b..0161be07d4bfa 100644 --- a/tests/baselines/reference/iterableArrayPattern25.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern25.errors.txt @@ -4,5 +4,5 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,1): error ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts (1 errors) ==== function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { } takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])); - ~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt b/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt index 23b7c200b83ee..dda54d6dbe3ca 100644 --- a/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt +++ b/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt @@ -14,15 +14,15 @@ tests/cases/compiler/bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. ==== tests/cases/compiler/bar.ts (3 errors) ==== f(); // Error - ~ + ~~~ !!! error TS2554: Expected 3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/foo.js:6:12: An argument for 'a' was not provided. f(1); // Error - ~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/compiler/foo.js:6:15: An argument for 'b' was not provided. f(1, 2); // Error - ~ + ~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6210 tests/cases/compiler/foo.js:6:18: An argument for 'c' was not provided. diff --git a/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt b/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt index 270050e03178b..3658797f87f02 100644 --- a/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt +++ b/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt @@ -15,15 +15,15 @@ tests/cases/conformance/jsdoc/a.js(13,1): error TS2554: Expected 1 arguments, bu } f() // should error - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:1:21: An argument for '0' was not provided. g() // should error - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:5:12: An argument for 's' was not provided. h() - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:8:12: An argument for 's' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/methodChainError.errors.txt b/tests/baselines/reference/methodChainError.errors.txt index 7cd4df95d4029..f9805a04720ec 100644 --- a/tests/baselines/reference/methodChainError.errors.txt +++ b/tests/baselines/reference/methodChainError.errors.txt @@ -1,8 +1,11 @@ -tests/cases/compiler/methodChainError.ts(9,6): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/methodChainError.ts(10,6): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/methodChainError.ts(16,6): error TS2349: This expression is not callable. + Type 'String' has no call signatures. -==== tests/cases/compiler/methodChainError.ts (1 errors) ==== +==== tests/cases/compiler/methodChainError.ts (2 errors) ==== class Builder { + notMethod: string method(param: string): Builder { return this; } @@ -10,7 +13,17 @@ tests/cases/compiler/methodChainError.ts(9,6): error TS2554: Expected 1 argument new Builder() .method("a") - .method(); - ~~~~~~ + .method() + ~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 tests/cases/compiler/methodChainError.ts:2:12: An argument for 'param' was not provided. \ No newline at end of file +!!! related TS6210 tests/cases/compiler/methodChainError.ts:3:12: An argument for 'param' was not provided. + .method("a"); + + + new Builder() + .method("a") + .notMethod() + ~~~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'String' has no call signatures. + .method("a"); \ No newline at end of file diff --git a/tests/baselines/reference/methodChainError.js b/tests/baselines/reference/methodChainError.js index 648ae505c7a32..7858386cb8633 100644 --- a/tests/baselines/reference/methodChainError.js +++ b/tests/baselines/reference/methodChainError.js @@ -1,5 +1,6 @@ //// [methodChainError.ts] class Builder { + notMethod: string method(param: string): Builder { return this; } @@ -7,7 +8,14 @@ class Builder { new Builder() .method("a") - .method(); + .method() + .method("a"); + + +new Builder() + .method("a") + .notMethod() + .method("a"); //// [methodChainError.js] var Builder = /** @class */ (function () { @@ -20,4 +28,9 @@ var Builder = /** @class */ (function () { }()); new Builder() .method("a") - .method(); + .method() + .method("a"); +new Builder() + .method("a") + .notMethod() + .method("a"); diff --git a/tests/baselines/reference/methodChainError.symbols b/tests/baselines/reference/methodChainError.symbols index e73024c784da4..f17cad3687067 100644 --- a/tests/baselines/reference/methodChainError.symbols +++ b/tests/baselines/reference/methodChainError.symbols @@ -2,9 +2,12 @@ class Builder { >Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + notMethod: string +>notMethod : Symbol(Builder.notMethod, Decl(methodChainError.ts, 0, 15)) + method(param: string): Builder { ->method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) ->param : Symbol(param, Decl(methodChainError.ts, 1, 11)) +>method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) +>param : Symbol(param, Decl(methodChainError.ts, 2, 11)) >Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) return this; @@ -13,13 +16,28 @@ class Builder { } new Builder() ->new Builder() .method("a") .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) ->new Builder() .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) +>new Builder() .method("a") .method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) +>new Builder() .method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) +>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + + .method("a") +>method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) + + .method() +>method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) + + .method("a"); + + +new Builder() +>new Builder() .method("a") .notMethod : Symbol(Builder.notMethod, Decl(methodChainError.ts, 0, 15)) +>new Builder() .method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) >Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) .method("a") ->method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) +>method : Symbol(Builder.method, Decl(methodChainError.ts, 1, 21)) - .method(); ->method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) + .notMethod() +>notMethod : Symbol(Builder.notMethod, Decl(methodChainError.ts, 0, 15)) + .method("a"); diff --git a/tests/baselines/reference/methodChainError.types b/tests/baselines/reference/methodChainError.types index e66f6c54b4596..3ab9e22bd425c 100644 --- a/tests/baselines/reference/methodChainError.types +++ b/tests/baselines/reference/methodChainError.types @@ -2,6 +2,9 @@ class Builder { >Builder : Builder + notMethod: string +>notMethod : string + method(param: string): Builder { >method : (param: string) => Builder >param : string @@ -12,6 +15,8 @@ class Builder { } new Builder() +>new Builder() .method("a") .method() .method("a") : any +>new Builder() .method("a") .method() .method : any >new Builder() .method("a") .method() : Builder >new Builder() .method("a") .method : (param: string) => Builder >new Builder() .method("a") : Builder @@ -23,6 +28,32 @@ new Builder() >method : (param: string) => Builder >"a" : "a" - .method(); + .method() +>method : (param: string) => Builder + + .method("a"); +>method : any +>"a" : "a" + + +new Builder() +>new Builder() .method("a") .notMethod() .method("a") : any +>new Builder() .method("a") .notMethod() .method : any +>new Builder() .method("a") .notMethod() : any +>new Builder() .method("a") .notMethod : string +>new Builder() .method("a") : Builder +>new Builder() .method : (param: string) => Builder +>new Builder() : Builder +>Builder : typeof Builder + + .method("a") >method : (param: string) => Builder +>"a" : "a" + + .notMethod() +>notMethod : string + + .method("a"); +>method : any +>"a" : "a" diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt index 009022bdfe3e1..4af2f331e040d 100644 --- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt +++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/salsa/a.js(4,6): error TS2554: Expected 1 arguments, but var mod1 = require('./mod1') mod1() mod1.f() // error, not enough arguments - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 /.src/tests/cases/conformance/salsa/mod1.js:4:30: An argument for 'a' was not provided. diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index d7a5196b04d80..274c0bcbe1373 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -31,7 +31,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error ~~~~~~ !!! error TS2339: Property 'method' does not exist on type '{}'. x(); - ~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. } diff --git a/tests/baselines/reference/neverTypeErrors1.errors.txt b/tests/baselines/reference/neverTypeErrors1.errors.txt index 98a488f5fe492..fe1dc42fb2d0e 100644 --- a/tests/baselines/reference/neverTypeErrors1.errors.txt +++ b/tests/baselines/reference/neverTypeErrors1.errors.txt @@ -35,7 +35,7 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(24,17): error TS2407: Th ~ !!! error TS2322: Type '{}' is not assignable to type 'never'. x(); - ~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'never' has no call signatures. } diff --git a/tests/baselines/reference/neverTypeErrors2.errors.txt b/tests/baselines/reference/neverTypeErrors2.errors.txt index 00f270c538487..5fb144fa91e09 100644 --- a/tests/baselines/reference/neverTypeErrors2.errors.txt +++ b/tests/baselines/reference/neverTypeErrors2.errors.txt @@ -35,7 +35,7 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(24,17): error TS2407: Th ~ !!! error TS2322: Type '{}' is not assignable to type 'never'. x(); - ~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'never' has no call signatures. } diff --git a/tests/baselines/reference/newAbstractInstance.errors.txt b/tests/baselines/reference/newAbstractInstance.errors.txt index bbb9fdae74ca2..48530f7d93cab 100644 --- a/tests/baselines/reference/newAbstractInstance.errors.txt +++ b/tests/baselines/reference/newAbstractInstance.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/newAbstractInstance.ts(3,1): error TS2351: This expression is not constructable. +tests/cases/compiler/newAbstractInstance.ts(3,5): error TS2351: This expression is not constructable. Type 'B' has no construct signatures. @@ -6,7 +6,7 @@ tests/cases/compiler/newAbstractInstance.ts(3,1): error TS2351: This expression abstract class B { } declare const b: B; new b(); - ~~~~~~~ + ~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'B' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/newOnInstanceSymbol.errors.txt b/tests/baselines/reference/newOnInstanceSymbol.errors.txt index 7a7d6a4ce9c3c..b6982d84c2a23 100644 --- a/tests/baselines/reference/newOnInstanceSymbol.errors.txt +++ b/tests/baselines/reference/newOnInstanceSymbol.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: This expression is not constructable. +tests/cases/compiler/newOnInstanceSymbol.ts(3,5): error TS2351: This expression is not constructable. Type 'C' has no construct signatures. @@ -6,6 +6,6 @@ tests/cases/compiler/newOnInstanceSymbol.ts(3,1): error TS2351: This expression class C {} var x = new C(); // should be ok new x(); // should error - ~~~~~~~ + ~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'C' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index 00bd2f9ac1780..30623c7c7c82b 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/newOperator.ts(3,13): error TS2693: 'ifc' only refers to a type, but is being used as a value here. -tests/cases/compiler/newOperator.ts(10,10): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(10,14): error TS2351: This expression is not constructable. Type 'Number' has no construct signatures. -tests/cases/compiler/newOperator.ts(11,10): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(11,14): error TS2351: This expression is not constructable. Type 'String' has no construct signatures. tests/cases/compiler/newOperator.ts(12,5): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/newOperator.ts(18,14): error TS2693: 'string' only refers to a type, but is being used as a value here. @@ -9,14 +9,14 @@ tests/cases/compiler/newOperator.ts(18,21): error TS1011: An element access expr tests/cases/compiler/newOperator.ts(21,1): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/newOperator.ts(22,2): error TS1011: An element access expression should take an argument. tests/cases/compiler/newOperator.ts(28,13): error TS2304: Cannot find name 'q'. -tests/cases/compiler/newOperator.ts(31,10): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(31,14): error TS2351: This expression is not constructable. Type 'Date' has no construct signatures. -tests/cases/compiler/newOperator.ts(38,1): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(38,5): error TS2351: This expression is not constructable. No constituent of type '{ a: string; } | { b: string; }' is constructable. -tests/cases/compiler/newOperator.ts(42,1): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(42,5): error TS2351: This expression is not constructable. Not all constituents of type '{ a: string; } | (new (a: string) => void)' are constructable. Type '{ a: string; }' has no construct signatures. -tests/cases/compiler/newOperator.ts(46,1): error TS2351: This expression is not constructable. +tests/cases/compiler/newOperator.ts(46,5): error TS2351: This expression is not constructable. Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expression should take an argument. @@ -34,11 +34,11 @@ tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expr // Target is not a class or var, good error var t1 = new 53(); - ~~~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'Number' has no construct signatures. var t2 = new ''(); - ~~~~~~~~ + ~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'String' has no construct signatures. new string; @@ -73,7 +73,7 @@ tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expr // not legal var t5 = new new Date; - ~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'Date' has no construct signatures. @@ -83,14 +83,14 @@ tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expr // Error on union declare const union: { a: string } | { b: string } new union; - ~~~~~~~~~ + ~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: No constituent of type '{ a: string; } | { b: string; }' is constructable. // Error on union with one constructor declare const ctorUnion: { a: string } | (new (a: string) => void) new ctorUnion(""); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Not all constituents of type '{ a: string; } | (new (a: string) => void)' are constructable. !!! error TS2351: Type '{ a: string; }' has no construct signatures. @@ -98,7 +98,7 @@ tests/cases/compiler/newOperator.ts(56,24): error TS1011: An element access expr // Error on union with incompatible constructors declare const ctorUnion2: (new (a: T) => void) | (new (a: string) => void) new ctorUnion2(""); - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Each member of the union type '(new (a: T) => void) | (new (a: string) => void)' has construct signatures, but none of those signatures are compatible with each other. diff --git a/tests/baselines/reference/objectSpreadNegative.errors.txt b/tests/baselines/reference/objectSpreadNegative.errors.txt index e0b24643241da..914df6d78d883 100644 --- a/tests/baselines/reference/objectSpreadNegative.errors.txt +++ b/tests/baselines/reference/objectSpreadNegative.errors.txt @@ -86,7 +86,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,11): error TS233 // functions are skipped let spreadFunc = { ...function () { } } spreadFunc(); // error, no call signature - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index 5b7c500db0c26..1617e5c125f79 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -137,19 +137,19 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 ~ !!! error TS2554: Expected 0 arguments, but got 1. c1o1.C1M2(); - ~~~~ + ~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:23:17: An argument for 'C1M2A1' was not provided. i1o1.C1M2(); - ~~~~ + ~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:11:10: An argument for 'C1M2A1' was not provided. F2(); - ~~ + ~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:45:13: An argument for 'F2A1' was not provided. L2(); - ~~ + ~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:50:20: An argument for 'L2A1' was not provided. c1o1.C1M2(1,2); @@ -177,19 +177,19 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 ~ !!! error TS2554: Expected 0-2 arguments, but got 3. c1o1.C1M4(); - ~~~~ + ~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:29:17: An argument for 'C1M4A1' was not provided. i1o1.C1M4(); - ~~~~ + ~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:13:10: An argument for 'C1M4A1' was not provided. F4(); - ~~ + ~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:47:13: An argument for 'F4A1' was not provided. L4(); - ~~ + ~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:52:20: An argument for 'L4A1' was not provided. diff --git a/tests/baselines/reference/overload1.errors.txt b/tests/baselines/reference/overload1.errors.txt index 6adc8b8b5792c..6133f4223119a 100644 --- a/tests/baselines/reference/overload1.errors.txt +++ b/tests/baselines/reference/overload1.errors.txt @@ -45,7 +45,7 @@ tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is n ~ !!! error TS2554: Expected 1-2 arguments, but got 3. z=x.g(); // no match - ~ + ~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/overload1.ts:17:11: An argument for 'n' was not provided. z=x.g(new O.B()); // ambiguous (up and down conversion) diff --git a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt index 95e9bf27d234d..6b64cd8a77311 100644 --- a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt +++ b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt @@ -17,7 +17,7 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: declare function f(arg: number): void; f(); // wrong number of arguments (#25683) - ~ + ~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts:8:31: An argument for 'arg' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt index bbb1f4b2ea55e..e2cc830e6172d 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt +++ b/tests/baselines/reference/recursiveBaseConstructorCreation3.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(6,27): error TS2314: Generic type 'abc' requires 1 type argument(s). -tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: This expression is not constructable. +tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,15): error TS2351: This expression is not constructable. Type 'typeof xyz' has no construct signatures. @@ -15,7 +15,7 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: T } var bar = new xyz(); // Error: Invalid 'new' expression. - ~~~~~~~~~ + ~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'typeof xyz' has no construct signatures. var r: xyz = bar.foo; \ No newline at end of file diff --git a/tests/baselines/reference/requiredInitializedParameter1.errors.txt b/tests/baselines/reference/requiredInitializedParameter1.errors.txt index e5963845d28da..f9baca7a1b55f 100644 --- a/tests/baselines/reference/requiredInitializedParameter1.errors.txt +++ b/tests/baselines/reference/requiredInitializedParameter1.errors.txt @@ -14,7 +14,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec f4(0, 1, 2); f1(0, 1); - ~~ + ~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:23: An argument for 'c' was not provided. f2(0, 1); @@ -22,7 +22,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec f4(0, 1); f1(0); - ~~ + ~~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:16: An argument for 'b' was not provided. f2(0); diff --git a/tests/baselines/reference/restParamsWithNonRestParams.errors.txt b/tests/baselines/reference/restParamsWithNonRestParams.errors.txt index 067cf6c826721..5bbcf92f70231 100644 --- a/tests/baselines/reference/restParamsWithNonRestParams.errors.txt +++ b/tests/baselines/reference/restParamsWithNonRestParams.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/restParamsWithNonRestParams.ts(4,1): error TS2555: Expected foo(); // ok function foo2(a:string, ...b:number[]){} foo2(); // should be an error - ~~~~ + ~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/restParamsWithNonRestParams.ts:3:15: An argument for 'a' was not provided. function foo3(a?:string, ...b:number[]){} diff --git a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt index d37b20f7403c4..393e21edb6c53 100644 --- a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt +++ b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt @@ -10,6 +10,6 @@ tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): err ): any; call(function* (a: 'a') { }); // error, 2nd argument required - ~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts:3:5: An argument for 'args' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/staticMemberExportAccess.errors.txt b/tests/baselines/reference/staticMemberExportAccess.errors.txt index 3da3171c8f159..64090a7ac31b4 100644 --- a/tests/baselines/reference/staticMemberExportAccess.errors.txt +++ b/tests/baselines/reference/staticMemberExportAccess.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/staticMemberExportAccess.ts(14,35): error TS2351: This expression is not constructable. +tests/cases/compiler/staticMemberExportAccess.ts(14,39): error TS2351: This expression is not constructable. Type 'Sammy' has no construct signatures. tests/cases/compiler/staticMemberExportAccess.ts(17,18): error TS2576: Property 'bar' is a static member of type 'Sammy' tests/cases/compiler/staticMemberExportAccess.ts(18,18): error TS2339: Property 'x' does not exist on type 'Sammy'. @@ -19,7 +19,7 @@ tests/cases/compiler/staticMemberExportAccess.ts(18,18): error TS2339: Property } var $: JQueryStatic; var instanceOfClassSammy: Sammy = new $.sammy(); // should be error - ~~~~~~~~~~~~~ + ~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'Sammy' has no construct signatures. var r1 = instanceOfClassSammy.foo(); // r1 is string diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 98d8a19db0638..cfeb557468525 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -47,7 +47,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error - ~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. let c02 = foo.call(undefined, 10, 20); // Error ~~ @@ -97,7 +97,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error - ~~~~ + ~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. let c12 = c.foo.call(c, 10, 20); // Error ~~ @@ -132,7 +132,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: C.call(c, 10, "hello"); C.call(c, 10); // Error - ~~~~ + ~~~~~~~~~~~ !!! error TS2554: Expected 3 arguments, but got 2. C.call(c, 10, 20); // Error ~~ diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 4d55ee6b22e39..ac229c6acef86 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -139,7 +139,7 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: This express static(); ~~~~~~ !!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode. - ~~~~~~~~ + ~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. } diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt b/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt index 5142ccdcebd7f..fb4e88881f920 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt +++ b/tests/baselines/reference/superCallParameterContextualTyping2.errors.txt @@ -12,7 +12,7 @@ tests/cases/conformance/expressions/contextualTyping/superCallParameterContextua class C extends A { // Ensure 'value' is not of type 'any' by invoking it with type arguments. constructor() { super(value => String(value())); } - ~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'Number' has no call signatures. } \ No newline at end of file diff --git a/tests/baselines/reference/superNewCall1.errors.txt b/tests/baselines/reference/superNewCall1.errors.txt index 27e179d4a4055..cd628cd02e771 100644 --- a/tests/baselines/reference/superNewCall1.errors.txt +++ b/tests/baselines/reference/superNewCall1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/superNewCall1.ts(8,5): error TS2377: Constructors for derived classes must contain a 'super' call. -tests/cases/compiler/superNewCall1.ts(9,9): error TS2351: This expression is not constructable. +tests/cases/compiler/superNewCall1.ts(9,13): error TS2351: This expression is not constructable. Type 'A' has no construct signatures. tests/cases/compiler/superNewCall1.ts(9,13): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. @@ -16,7 +16,7 @@ tests/cases/compiler/superNewCall1.ts(9,13): error TS17011: 'super' must be call ~~~~~~~~~~~~~~~ new super(value => String(value)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'A' has no construct signatures. ~~~~~ diff --git a/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt b/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt index 2b51a74525e21..f461d3fa8221c 100644 --- a/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt +++ b/tests/baselines/reference/taggedTemplateWithConstructableTag01.errors.txt @@ -6,6 +6,6 @@ tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag01.ts(3, class CtorTag { } CtorTag `Hello world!`; - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'typeof CtorTag' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt b/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt index 3a502a288a647..16e028a0a3c0b 100644 --- a/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt +++ b/tests/baselines/reference/taggedTemplateWithConstructableTag02.errors.txt @@ -9,6 +9,6 @@ tests/cases/conformance/es6/templates/taggedTemplateWithConstructableTag02.ts(6, } var tag: I; tag `Hello world!`; - ~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'I' has no 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 29a80ff966eab..5d9c037ef90f4 100644 --- a/tests/baselines/reference/templateStringInCallExpression.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpression.errors.txt @@ -4,6 +4,6 @@ tests/cases/conformance/es6/templates/templateStringInCallExpression.ts(1,1): er ==== tests/cases/conformance/es6/templates/templateStringInCallExpression.ts (1 errors) ==== `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no 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 32d9240681f02..ab75cf8b98104 100644 --- a/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInCallExpressionES6.errors.txt @@ -4,6 +4,6 @@ tests/cases/conformance/es6/templates/templateStringInCallExpressionES6.ts(1,1): ==== tests/cases/conformance/es6/templates/templateStringInCallExpressionES6.ts (1 errors) ==== `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewExpression.errors.txt b/tests/baselines/reference/templateStringInNewExpression.errors.txt index fbe4f67fc8c9d..a56f573e9f641 100644 --- a/tests/baselines/reference/templateStringInNewExpression.errors.txt +++ b/tests/baselines/reference/templateStringInNewExpression.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewExpression.ts(1,1): error TS2351: This expression is not constructable. +tests/cases/conformance/es6/templates/templateStringInNewExpression.ts(1,5): error TS2351: This expression is not constructable. Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewExpression.ts (1 errors) ==== new `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt b/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt index bcbd8e9927c75..a83633358ab39 100644 --- a/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInNewExpressionES6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts(1,1): error TS2351: This expression is not constructable. +tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts(1,5): error TS2351: This expression is not constructable. Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewExpressionES6.ts (1 errors) ==== new `abc${0}abc`(`hello ${0} world`, ` `, `1${2}3`); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewOperator.errors.txt b/tests/baselines/reference/templateStringInNewOperator.errors.txt index 17043882c3674..3168cb5ffc1fd 100644 --- a/tests/baselines/reference/templateStringInNewOperator.errors.txt +++ b/tests/baselines/reference/templateStringInNewOperator.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewOperator.ts(1,9): error TS2351: This expression is not constructable. +tests/cases/conformance/es6/templates/templateStringInNewOperator.ts(1,13): error TS2351: This expression is not constructable. Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewOperator.ts (1 errors) ==== var x = new `abc${ 1 }def`; - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt b/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt index 3ee887edf3923..cac1adcad861a 100644 --- a/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt +++ b/tests/baselines/reference/templateStringInNewOperatorES6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts(1,9): error TS2351: This expression is not constructable. +tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts(1,13): error TS2351: This expression is not constructable. Type 'String' has no construct signatures. ==== tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts (1 errors) ==== var x = new `abc${ 1 }def`; - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type 'String' has no construct signatures. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt index 8863b52ccb21c..7b16fa46082b1 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt @@ -11,10 +11,9 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): err ~ a: `abc${ 123 }def`, ~~~~~~~~~~~~~~~~~~~~~~~~ - `b`: 321 - ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{ a: string; }' has no call signatures. + `b`: 321 ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt index 028488f414d40..699ca02829ea4 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt @@ -11,10 +11,9 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(4,1): ~ a: `abc${ 123 }def`, ~~~~~~~~~~~~~~~~~~~~~~~~ - `b`: 321 - ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{ a: string; }' has no call signatures. + `b`: 321 ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName1.errors.txt b/tests/baselines/reference/templateStringInPropertyName1.errors.txt index 39c694532a7a1..0f9c6be5a8088 100644 --- a/tests/baselines/reference/templateStringInPropertyName1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName1.errors.txt @@ -9,10 +9,9 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts(3,1): err ==== tests/cases/conformance/es6/templates/templateStringInPropertyName1.ts (5 errors) ==== var x = { ~ - `a`: 321 - ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. + `a`: 321 ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyName2.errors.txt b/tests/baselines/reference/templateStringInPropertyName2.errors.txt index 40206f0e9ea0b..b7b9a1bf08f2c 100644 --- a/tests/baselines/reference/templateStringInPropertyName2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyName2.errors.txt @@ -9,10 +9,9 @@ tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts(3,1): err ==== tests/cases/conformance/es6/templates/templateStringInPropertyName2.ts (5 errors) ==== var x = { ~ - `abc${ 123 }def${ 456 }ghi`: 321 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. + `abc${ 123 }def${ 456 }ghi`: 321 ~~~~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt b/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt index 6fbd787c7dc68..abddfb073e3a3 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_1.errors.txt @@ -9,10 +9,9 @@ tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts(3,1): ==== tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_1.ts (5 errors) ==== var x = { ~ - `a`: 321 - ~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. + `a`: 321 ~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt b/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt index f1908f7498d22..38752f524eab8 100644 --- a/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt +++ b/tests/baselines/reference/templateStringInPropertyNameES6_2.errors.txt @@ -9,10 +9,9 @@ tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts(3,1): ==== tests/cases/conformance/es6/templates/templateStringInPropertyNameES6_2.ts (5 errors) ==== var x = { ~ - `abc${ 123 }def${ 456 }ghi`: 321 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. + `abc${ 123 }def${ 456 }ghi`: 321 ~~~~~~ !!! error TS1136: Property assignment expected. ~ diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 3a527b6118371..fe385011df957 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -4,6 +4,6 @@ tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): er ==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no 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 142cd05bbcc31..ef6c5c459d1d4 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplateES6.errors.txt @@ -4,6 +4,6 @@ tests/cases/conformance/es6/templates/templateStringInTaggedTemplateES6.ts(1,1): ==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplateES6.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'String' has no call signatures. \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 4720b4556a44a..11d554f39eb72 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -182,7 +182,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. ok.f(); // not enough arguments - ~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided. ok.f('wrong type'); @@ -204,7 +204,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e let c = new C(); c.explicitC(); // not enough arguments - ~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided. c.explicitC('wrong type'); @@ -214,7 +214,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.explicitThis(); // not enough arguments - ~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided. c.explicitThis('wrong type 2'); @@ -224,7 +224,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.implicitThis(); // not enough arguments - ~~~~~~~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided. c.implicitThis('wrong type 2'); @@ -234,7 +234,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.explicitProperty(); // not enough arguments - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided. c.explicitProperty('wrong type 3'); diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt index ae8a5cb6897db..24a79443689e0 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt @@ -11,6 +11,6 @@ tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,3): error TS2554: E ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. x.b(); // error - ~ + ~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/typeAssertionToGenericFunctionType.ts:3:12: An argument for 'x' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt index fea09e516748a..ef74a0a4ee29f 100644 --- a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt +++ b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(1,19): error TS2313: Type parameter 'T' has a circular constraint. tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(4,19): error TS2339: Property 'foo' does not exist on type 'T'. -tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(5,17): error TS2351: This expression is not constructable. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(5,21): error TS2351: This expression is not constructable. Type '{}' has no construct signatures. tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS2349: This expression is not callable. Type '{}' has no call signatures. @@ -16,12 +16,12 @@ tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS23 ~~~ !!! error TS2339: Property 'foo' does not exist on type 'T'. var b = new x(123); - ~~~~~~~~~~ + ~ !!! error TS2351: This expression is not constructable. !!! error TS2351: Type '{}' has no construct signatures. var c = x[1]; var d = x(); - ~~~ + ~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type '{}' has no call signatures. } diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index 261f0029999d1..2c80ac58cc8f4 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -50,7 +50,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~ !!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. unionOfDifferentReturnType1(); // error missing parameter - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:12:37: An argument for 'a' was not provided. @@ -62,13 +62,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'. unionOfDifferentParameterTypes();// error - no call signatures - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:18:40: An argument for 'a' was not provided. var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:23:44: An argument for 'a' was not provided. unionOfDifferentNumberOfSignatures(10); // error - no call signatures @@ -78,11 +78,11 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:28:69: An argument for 'a' was not provided. unionWithDifferentParameterCount("hello");// needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:28:80: An argument for 'b' was not provided. unionWithDifferentParameterCount("hello", 10);// OK @@ -94,13 +94,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter1(); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:33:37: An argument for 'a' was not provided. var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number }; strOrNum = unionWithOptionalParameter2('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:87: An argument for 'b' was not provided. strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature @@ -108,7 +108,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter2(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:76: An argument for 'a' was not provided. @@ -119,7 +119,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter3(); // needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:45:37: An argument for 'a' was not provided. @@ -131,13 +131,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter1(); // error - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:51:33: An argument for 'a' was not provided. var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number }; strOrNum = unionWithRestParameter2('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:87: An argument for 'b' was not provided. strOrNum = unionWithRestParameter2('hello', 10); // error no call signature @@ -148,7 +148,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter2(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:76: An argument for 'a' was not provided. @@ -160,13 +160,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter3(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:65:33: An argument for 'a' was not provided. var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:72:76: An argument for 'b' was not provided. strOrNum = unionWithRestParameter4("hello", "world"); diff --git a/tests/baselines/reference/unionTypeCallSignatures4.errors.txt b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt index e991b211db21a..37f8d7708c5d2 100644 --- a/tests/baselines/reference/unionTypeCallSignatures4.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt @@ -26,7 +26,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,18): error TS var f12345: F1 | F2 | F3 | F4 | F5; f12345("a"); // error - ~~~~~~ + ~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures4.ts:5:23: An argument for 'b' was not provided. f12345("a", "b"); diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt index 3722fcadaa344..06d06d7f33d47 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.errors.txt @@ -39,7 +39,7 @@ tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts(41,4): error TS2 var c2: C; var r4 = c2(); // should be an error - ~~~~~~~~~~~~ + ~~ !!! error TS2349: This expression is not callable. !!! error TS2349: Type 'C' has no call signatures. diff --git a/tests/cases/compiler/methodChainError.ts b/tests/cases/compiler/methodChainError.ts index 657d9a634a53f..c98d0e8cfabe3 100644 --- a/tests/cases/compiler/methodChainError.ts +++ b/tests/cases/compiler/methodChainError.ts @@ -1,4 +1,5 @@ class Builder { + notMethod: string method(param: string): Builder { return this; } @@ -6,4 +7,11 @@ class Builder { new Builder() .method("a") - .method(); \ No newline at end of file + .method() + .method("a"); + + +new Builder() + .method("a") + .notMethod() + .method("a"); \ No newline at end of file