diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cf614ee201..cd90880654 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 0f02c79172..7d178f1d47 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 85dff7fb09..4ef030d62e 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 f5358b45a4..5c67734b34 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 16ea001c99..7b6010df12 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 dc71d916a3..3cdab34055 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 b839a20974..867b0ca7a4 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 ef088d8935..742bfc7cfb 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 ae694a321b..449af44e32 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 f0d821d89c..a27810e9fc 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 02ac17bb10..ac6b1df60b 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 21aaa93809..4d9330d16f 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 bb0047880c..65d72b9183 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 326ad2f18c..2915e86909 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 0cf20b5c86..d7a5196b04 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 c0dd83fb1c..98a488f5fe 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 b81323cbfb..00f270c538 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 13a5aff9df..bbb9fdae74 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 99af44524c..7a7d6a4ce9 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 fb98482d85..00bd2f9ac1 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 160d385c06..1c4756399c 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 33f9ea6368..4578004151 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 2d8f252516..86bec09b89 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 bb064283a7..e0b2464324 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 bd39249289..bbb1f4b2ea 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 71fe50d480..3da3171c8f 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 6ddfbe3287..4d55ee6b22 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 040f6c6435..5142ccdceb 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 3ec370518c..27e179d4a4 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 9815338f2e..2b51a74525 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 f3946d5a4f..3a502a288a 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 cd5e2ff7c6..29a80ff966 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 fd47a8001a..32d9240681 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 00ae3a6e4a..fbe4f67fc8 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 3170afc98b..bcbd8e9927 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 eed7415e5d..17043882c3 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 f4363d9ff2..3ee887edf3 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 234ccfdcae..8863b52ccb 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 4c78dbea2c..028488f414 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 15f4415611..39c694532a 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 d9e5d73dd0..40206f0e9e 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 620b324855..6fbd787c7d 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 00ef4e511b..f1908f7498 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 9494f03a8b..3a527b6118 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 581e084e73..142cd05bbc 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 e9dfb5ba3c..fea09e5167 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 e7f5fc9913..3722fcadaa 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 1d7813400c..6bb28daabb 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 {