From 76c6ee6e5362fdc894ace3884502e4881ddb0d6b Mon Sep 17 00:00:00 2001 From: iliashkolyar Date: Tue, 11 Sep 2018 08:04:09 +0300 Subject: [PATCH 001/294] Codefix: add quick fix for missing 'new' operator --- src/compiler/diagnosticMessages.json | 15 +++++++--- .../codefixes/fixAddMissingNewOperator.ts | 29 +++++++++++++++++++ src/services/tsconfig.json | 1 + tests/cases/fourslash/codeFixAddMissingNew.ts | 13 +++++++++ .../fourslash/codeFixAddMissingNew_all.ts | 18 ++++++++++++ 5 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 src/services/codefixes/fixAddMissingNewOperator.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingNew.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingNew_all.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7a57b89d320..f4ba04df38f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4608,7 +4608,6 @@ "category": "Message", "code": 95062 }, - "Add missing enum member '{0}'": { "category": "Message", "code": 95063 @@ -4619,10 +4618,18 @@ }, "Convert to async function":{ "category": "Message", - "code": 95065 + "code": 95065 }, "Convert all to async functions": { - "category": "Message", - "code": 95066 + "category": "Message", + "code": 95066 + }, + "Add missing 'new' operator to caller": { + "category": "Message", + "code": 95067 + }, + "Add missing 'new' operator to all callers": { + "category": "Message", + "code": 95068 } } diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts new file mode 100644 index 00000000000..b1eca15e185 --- /dev/null +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -0,0 +1,29 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "addMissingNewOperator"; + const errorCodes = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; + registerCodeFix({ + errorCodes, + getCodeActions(context) { + const { sourceFile, span } = context; + const identifierWithoutNew = getIdentifier(sourceFile, span.start); + const changes = textChanges.ChangeTracker.with(context, t => addMissingNewOperator(t, sourceFile, identifierWithoutNew)); + return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_new_operator_to_caller, fixId, Diagnostics.Add_missing_new_operator_to_all_callers)]; + }, + fixIds: [fixId], + getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => + addMissingNewOperator(changes, context.sourceFile, getIdentifier(diag.file, diag.start))), + }); + + function getIdentifier(sourceFile: SourceFile, pos: number): Identifier { + const token = getTokenAtPosition(sourceFile, pos); + Debug.assert(token.kind === SyntaxKind.Identifier); + Debug.assert(isCallExpression(token.parent)); + return token; + } + + function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, identifierWithoutNew: Identifier): void { + const newTypeNode = createNew(identifierWithoutNew, /*typeArguments*/ undefined, /*argumentsArray*/ undefined); + changes.replaceNode(sourceFile, identifierWithoutNew, newTypeNode); + } +} diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index fee6da0f8a3..6ea6f09b9f5 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -53,6 +53,7 @@ "codefixes/importFixes.ts", "codefixes/fixSpelling.ts", "codefixes/fixAddMissingMember.ts", + "codefixes/fixAddMissingNewOperator.ts", "codefixes/fixCannotFindModule.ts", "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", "codefixes/fixClassSuperMustPrecedeThisAccess.ts", diff --git a/tests/cases/fourslash/codeFixAddMissingNew.ts b/tests/cases/fourslash/codeFixAddMissingNew.ts new file mode 100644 index 00000000000..ee539387750 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew.ts @@ -0,0 +1,13 @@ +/// + +////class C { +////} +////var c = C(); + +verify.codeFix({ + description: "Add missing 'new' operator to caller", + index: 0, + newFileContent: `class C { +} +var c = new C();` +}); diff --git a/tests/cases/fourslash/codeFixAddMissingNew_all.ts b/tests/cases/fourslash/codeFixAddMissingNew_all.ts new file mode 100644 index 00000000000..e8cca308c03 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew_all.ts @@ -0,0 +1,18 @@ +/// + +////class C { +//// constructor(num?: number) {} +////} +////var a = C(); +////var b = C(3); + +verify.codeFixAll({ + fixId: "addMissingNewOperator", + fixAllDescription: "Add missing 'new' operator to all callers", + newFileContent: +`class C { + constructor(num?: number) {} +} +var a = new C(); +var b = new C(3);` +}); From 8b14fb22ecf22aa5b95f66dee011c69686b458b4 Mon Sep 17 00:00:00 2001 From: iliashkolyar Date: Tue, 11 Sep 2018 13:56:51 +0300 Subject: [PATCH 002/294] Initial review --- src/compiler/diagnosticMessages.json | 4 ++-- .../codefixes/fixAddMissingNewOperator.ts | 19 ++++++++-------- tests/cases/fourslash/codeFixAddMissingNew.ts | 2 +- .../fourslash/codeFixAddMissingNew_all.ts | 2 +- .../codeFixAddMissingNew_all_arguments.ts | 22 +++++++++++++++++++ 5 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 tests/cases/fourslash/codeFixAddMissingNew_all_arguments.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f4ba04df38f..2464b24a89b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4624,11 +4624,11 @@ "category": "Message", "code": 95066 }, - "Add missing 'new' operator to caller": { + "Add missing 'new' operator to call": { "category": "Message", "code": 95067 }, - "Add missing 'new' operator to all callers": { + "Add missing 'new' operator to all calls": { "category": "Message", "code": 95068 } diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index b1eca15e185..8b01ccd7815 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -6,24 +6,23 @@ namespace ts.codefix { errorCodes, getCodeActions(context) { const { sourceFile, span } = context; - const identifierWithoutNew = getIdentifier(sourceFile, span.start); - const changes = textChanges.ChangeTracker.with(context, t => addMissingNewOperator(t, sourceFile, identifierWithoutNew)); - return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_new_operator_to_caller, fixId, Diagnostics.Add_missing_new_operator_to_all_callers)]; + const missingNewExpression = getMissingNewExpression(sourceFile, span.start); + const changes = textChanges.ChangeTracker.with(context, t => addMissingNewOperator(t, sourceFile, missingNewExpression)); + return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_new_operator_to_call, fixId, Diagnostics.Add_missing_new_operator_to_all_calls)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => - addMissingNewOperator(changes, context.sourceFile, getIdentifier(diag.file, diag.start))), + addMissingNewOperator(changes, context.sourceFile, getMissingNewExpression(diag.file, diag.start))), }); - function getIdentifier(sourceFile: SourceFile, pos: number): Identifier { + function getMissingNewExpression(sourceFile: SourceFile, pos: number): Expression { const token = getTokenAtPosition(sourceFile, pos); - Debug.assert(token.kind === SyntaxKind.Identifier); Debug.assert(isCallExpression(token.parent)); - return token; + return token; } - function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, identifierWithoutNew: Identifier): void { - const newTypeNode = createNew(identifierWithoutNew, /*typeArguments*/ undefined, /*argumentsArray*/ undefined); - changes.replaceNode(sourceFile, identifierWithoutNew, newTypeNode); + function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, missingNewExpression: Expression): void { + const newTypeNode = createNew(missingNewExpression, /*typeArguments*/ undefined, /*argumentsArray*/ undefined); + changes.replaceNode(sourceFile, missingNewExpression, newTypeNode); } } diff --git a/tests/cases/fourslash/codeFixAddMissingNew.ts b/tests/cases/fourslash/codeFixAddMissingNew.ts index ee539387750..84ac58280ee 100644 --- a/tests/cases/fourslash/codeFixAddMissingNew.ts +++ b/tests/cases/fourslash/codeFixAddMissingNew.ts @@ -5,7 +5,7 @@ ////var c = C(); verify.codeFix({ - description: "Add missing 'new' operator to caller", + description: "Add missing 'new' operator to call", index: 0, newFileContent: `class C { } diff --git a/tests/cases/fourslash/codeFixAddMissingNew_all.ts b/tests/cases/fourslash/codeFixAddMissingNew_all.ts index e8cca308c03..019f5b5a5a4 100644 --- a/tests/cases/fourslash/codeFixAddMissingNew_all.ts +++ b/tests/cases/fourslash/codeFixAddMissingNew_all.ts @@ -8,7 +8,7 @@ verify.codeFixAll({ fixId: "addMissingNewOperator", - fixAllDescription: "Add missing 'new' operator to all callers", + fixAllDescription: "Add missing 'new' operator to all calls", newFileContent: `class C { constructor(num?: number) {} diff --git a/tests/cases/fourslash/codeFixAddMissingNew_all_arguments.ts b/tests/cases/fourslash/codeFixAddMissingNew_all_arguments.ts new file mode 100644 index 00000000000..130dfd28fd7 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew_all_arguments.ts @@ -0,0 +1,22 @@ +/// + +////class C { +//// x?: T; +//// constructor(x: T) { this.x = x; } +////} +////let a = C(1, 2, 3); +////let b = C("hello"); +////let c = C(); + +verify.codeFixAll({ + fixId: "addMissingNewOperator", + fixAllDescription: "Add missing 'new' operator to all calls", + newFileContent: +`class C { + x?: T; + constructor(x: T) { this.x = x; } +} +let a = new C(1, 2, 3); +let b = new C("hello"); +let c = new C();` +}); From 7c15378376a3ae05e1e553a9af56ce63c10d22c6 Mon Sep 17 00:00:00 2001 From: iliashkolyar Date: Thu, 13 Sep 2018 08:30:43 +0300 Subject: [PATCH 003/294] InsertNode instead of replace + handling call expressions --- .../codefixes/fixAddMissingNewOperator.ts | 26 ++++++++++++------- tests/cases/fourslash/codeFixAddMissingNew.ts | 3 ++- .../cases/fourslash/codeFixAddMissingNew2.ts | 14 ++++++++++ .../cases/fourslash/codeFixAddMissingNew3.ts | 16 ++++++++++++ .../cases/fourslash/codeFixAddMissingNew4.ts | 18 +++++++++++++ 5 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 tests/cases/fourslash/codeFixAddMissingNew2.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingNew3.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingNew4.ts diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index 8b01ccd7815..ce68659be72 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -6,23 +6,29 @@ namespace ts.codefix { errorCodes, getCodeActions(context) { const { sourceFile, span } = context; - const missingNewExpression = getMissingNewExpression(sourceFile, span.start); - const changes = textChanges.ChangeTracker.with(context, t => addMissingNewOperator(t, sourceFile, missingNewExpression)); + const changes = textChanges.ChangeTracker.with(context, t => addMissingNewOperator(t, sourceFile, span)); return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_new_operator_to_call, fixId, Diagnostics.Add_missing_new_operator_to_all_calls)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => - addMissingNewOperator(changes, context.sourceFile, getMissingNewExpression(diag.file, diag.start))), + addMissingNewOperator(changes, context.sourceFile, diag)), }); - function getMissingNewExpression(sourceFile: SourceFile, pos: number): Expression { - const token = getTokenAtPosition(sourceFile, pos); - Debug.assert(isCallExpression(token.parent)); - return token; + function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, span: TextSpan): void { + const call = cast(findAncestorMatchingSpan(sourceFile, span), isCallExpression); + changes.insertNodeAt(sourceFile, span.start, createToken(SyntaxKind.NewKeyword), { suffix: " " }); + if (isCallExpression(call.expression)) { + changes.insertNodeAt(sourceFile, call.expression.getStart(sourceFile), createToken(SyntaxKind.OpenParenToken)); + changes.insertNodeAt(sourceFile, call.expression.end, createToken(SyntaxKind.CloseParenToken)); + } } - function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, missingNewExpression: Expression): void { - const newTypeNode = createNew(missingNewExpression, /*typeArguments*/ undefined, /*argumentsArray*/ undefined); - changes.replaceNode(sourceFile, missingNewExpression, newTypeNode); + function findAncestorMatchingSpan(sourceFile: SourceFile, span: TextSpan): Node { + let token = getTokenAtPosition(sourceFile, span.start); + const end = textSpanEnd(span); + while (token.end < end) { + token = token.parent; + } + return token; } } diff --git a/tests/cases/fourslash/codeFixAddMissingNew.ts b/tests/cases/fourslash/codeFixAddMissingNew.ts index 84ac58280ee..ff1ce125c96 100644 --- a/tests/cases/fourslash/codeFixAddMissingNew.ts +++ b/tests/cases/fourslash/codeFixAddMissingNew.ts @@ -7,7 +7,8 @@ verify.codeFix({ description: "Add missing 'new' operator to call", index: 0, - newFileContent: `class C { + newFileContent: +`class C { } var c = new C();` }); diff --git a/tests/cases/fourslash/codeFixAddMissingNew2.ts b/tests/cases/fourslash/codeFixAddMissingNew2.ts new file mode 100644 index 00000000000..a90b1c580dd --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew2.ts @@ -0,0 +1,14 @@ +/// + +////class C { +////} +////let x = (() => C)()(); + +verify.codeFix({ + description: "Add missing 'new' operator to call", + index: 0, + newFileContent: +`class C { +} +let x = new ((() => C)())();` +}); diff --git a/tests/cases/fourslash/codeFixAddMissingNew3.ts b/tests/cases/fourslash/codeFixAddMissingNew3.ts new file mode 100644 index 00000000000..c420d0446ba --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew3.ts @@ -0,0 +1,16 @@ +/// + +////class C { +////} +////let x = [C]; +////let a = x[0](); + +verify.codeFix({ + description: "Add missing 'new' operator to call", + index: 0, + newFileContent: +`class C { +} +let x = [C]; +let a = new x[0]();` +}); diff --git a/tests/cases/fourslash/codeFixAddMissingNew4.ts b/tests/cases/fourslash/codeFixAddMissingNew4.ts new file mode 100644 index 00000000000..e216b28bf50 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew4.ts @@ -0,0 +1,18 @@ +/// + +////class C { +////} +////class D { +////} +////let x = (true ? C : D)(); + +verify.codeFix({ + description: "Add missing 'new' operator to call", + index: 0, + newFileContent: +`class C { +} +class D { +} +let x = new (true ? C : D)();` +}); From 5ab8bd85aeb280d47c1641c06c30511744b8069b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Sep 2018 17:49:09 -0700 Subject: [PATCH 004/294] Try to find object/intersection types with the most overlap when failing assignability against unions. --- src/compiler/checker.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6f541461b09..9e74fb8521c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11472,7 +11472,8 @@ namespace ts { findMatchingDiscriminantType(source, target) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || - findBestTypeForInvokable(source, target); + findBestTypeForInvokable(source, target) || + findMostOverlappyType(source, target); isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], /*reportErrors*/ true); } @@ -11512,6 +11513,32 @@ namespace ts { } } + function findMostOverlappyType(source: Type, unionTarget: UnionOrIntersectionType) { + if (!(source.flags & (TypeFlags.Object | TypeFlags.Intersection))) { + return undefined; + } + const sourceProperties = getPropertiesOfType(source); + let bestType; + let count = -1; + for (const target of unionTarget.types) { + if (!(target.flags & (TypeFlags.Object | TypeFlags.Intersection))) { + continue; + } + + let currentCount = 0; + for (const prop of sourceProperties) { + if (getPropertyOfType(target, prop.escapedName)) { + currentCount++; + } + } + if (currentCount >= count) { + count = currentCount; + bestType = target; + } + } + return bestType; + } + // Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly function findMatchingDiscriminantType(source: Type, target: UnionOrIntersectionType) { let match: Type | undefined; From 76e721f3898bb03560b0466b765e087ea91f449e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Sep 2018 17:53:53 -0700 Subject: [PATCH 005/294] Added tests. --- .../errorsOnUnionsOfOverlappingObjects01.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts diff --git a/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts b/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts new file mode 100644 index 00000000000..aec1821c162 --- /dev/null +++ b/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts @@ -0,0 +1,29 @@ +interface Foo { + a: string; + b: number; +}; + +interface Bar { + b: string; +} + +interface Other { + totallyUnrelatedProperty: number; +} + +export let x = { a: '', b: '' }; + +declare function f(x: Foo | Other): any; + +f(x); +f({ a: '', b: '' }) + +declare function g(x: Bar | Other): any; + +g(x); +g({ a: '', b: '' }) + +declare function h(x: Foo | Bar | Other): any; + +h(x); +h({ a: '', b: '' }) From 91af958e109583db9529cfcde2aa95cd1a7c64a7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Sep 2018 17:54:06 -0700 Subject: [PATCH 006/294] Accepted baselines. --- ...lTypeWithUnionTypeObjectLiteral.errors.txt | 24 +++--- ...sOnUnionsOfOverlappingObjects01.errors.txt | 56 +++++++++++++ .../errorsOnUnionsOfOverlappingObjects01.js | 43 ++++++++++ ...rorsOnUnionsOfOverlappingObjects01.symbols | 77 +++++++++++++++++ ...errorsOnUnionsOfOverlappingObjects01.types | 82 +++++++++++++++++++ .../excessPropertyCheckWithUnions.errors.txt | 8 +- .../intersectionAndUnionTypes.errors.txt | 24 +++--- ...eWithRecursiveSubtypeReduction2.errors.txt | 14 +++- 8 files changed, 298 insertions(+), 30 deletions(-) create mode 100644 tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.errors.txt create mode 100644 tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.js create mode 100644 tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.symbols create mode 100644 tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.types diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt index fb44cb57da7..733e18307fd 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt +++ b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt @@ -9,13 +9,15 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts( Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(21,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'. - Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'. + Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'. Types of property 'prop' are incompatible. - Type 'string | number' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(25,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'. - Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'. - Property 'anotherP1' is missing in type '{ prop: string | number; anotherP: string; }'. + Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'. + Types of property 'prop' are incompatible. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(29,5): error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'. Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: number; anotherP1: number; }'. Types of property 'prop' are incompatible. @@ -63,18 +65,20 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts( var objStrOrNum6: { prop: string; anotherP: string; } | { prop: number } = { ~~~~~~~~~~~~ !!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'. -!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'. +!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'. !!! error TS2322: Types of property 'prop' are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. prop: strOrNumber, anotherP: str }; var objStrOrNum7: { prop: string; anotherP: string; } | { prop: number; anotherP1: number } = { ~~~~~~~~~~~~ !!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'. -!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'. -!!! error TS2322: Property 'anotherP1' is missing in type '{ prop: string | number; anotherP: string; }'. +!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'. +!!! error TS2322: Types of property 'prop' are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. prop: strOrNumber, anotherP: str }; diff --git a/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.errors.txt b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.errors.txt new file mode 100644 index 00000000000..3944c430f33 --- /dev/null +++ b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.errors.txt @@ -0,0 +1,56 @@ +tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(18,3): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'. + Type '{ a: string; b: string; }' is not assignable to type 'Foo'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(19,3): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'. + Type '{ a: string; b: string; }' is not assignable to type 'Foo'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(24,5): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Bar | Other'. + Object literal may only specify known properties, and 'a' does not exist in type 'Bar | Other'. + + +==== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts (3 errors) ==== + interface Foo { + a: string; + b: number; + }; + + interface Bar { + b: string; + } + + interface Other { + totallyUnrelatedProperty: number; + } + + export let x = { a: '', b: '' }; + + declare function f(x: Foo | Other): any; + + f(x); + ~ +!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'. +!!! error TS2345: Type '{ a: string; b: string; }' is not assignable to type 'Foo'. +!!! error TS2345: Types of property 'b' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + f({ a: '', b: '' }) + ~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'. +!!! error TS2345: Type '{ a: string; b: string; }' is not assignable to type 'Foo'. +!!! error TS2345: Types of property 'b' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + + declare function g(x: Bar | Other): any; + + g(x); + g({ a: '', b: '' }) + ~~~~~ +!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Bar | Other'. +!!! error TS2345: Object literal may only specify known properties, and 'a' does not exist in type 'Bar | Other'. + + declare function h(x: Foo | Bar | Other): any; + + h(x); + h({ a: '', b: '' }) + \ No newline at end of file diff --git a/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.js b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.js new file mode 100644 index 00000000000..36824508b12 --- /dev/null +++ b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.js @@ -0,0 +1,43 @@ +//// [errorsOnUnionsOfOverlappingObjects01.ts] +interface Foo { + a: string; + b: number; +}; + +interface Bar { + b: string; +} + +interface Other { + totallyUnrelatedProperty: number; +} + +export let x = { a: '', b: '' }; + +declare function f(x: Foo | Other): any; + +f(x); +f({ a: '', b: '' }) + +declare function g(x: Bar | Other): any; + +g(x); +g({ a: '', b: '' }) + +declare function h(x: Foo | Bar | Other): any; + +h(x); +h({ a: '', b: '' }) + + +//// [errorsOnUnionsOfOverlappingObjects01.js] +"use strict"; +exports.__esModule = true; +; +exports.x = { a: '', b: '' }; +f(exports.x); +f({ a: '', b: '' }); +g(exports.x); +g({ a: '', b: '' }); +h(exports.x); +h({ a: '', b: '' }); diff --git a/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.symbols b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.symbols new file mode 100644 index 00000000000..0ce5d6fd2d4 --- /dev/null +++ b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts === +interface Foo { +>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0)) + + a: string; +>a : Symbol(Foo.a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 15)) + + b: number; +>b : Symbol(Foo.b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 1, 14)) + +}; + +interface Bar { +>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2)) + + b: string; +>b : Symbol(Bar.b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 5, 15)) +} + +interface Other { +>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1)) + + totallyUnrelatedProperty: number; +>totallyUnrelatedProperty : Symbol(Other.totallyUnrelatedProperty, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 9, 17)) +} + +export let x = { a: '', b: '' }; +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10)) +>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 16)) +>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 23)) + +declare function f(x: Foo | Other): any; +>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 15, 19)) +>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0)) +>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1)) + +f(x); +>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10)) + +f({ a: '', b: '' }) +>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32)) +>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 3)) +>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 10)) + +declare function g(x: Bar | Other): any; +>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 20, 19)) +>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2)) +>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1)) + +g(x); +>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10)) + +g({ a: '', b: '' }) +>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19)) +>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 3)) +>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 10)) + +declare function h(x: Foo | Bar | Other): any; +>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 25, 19)) +>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0)) +>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2)) +>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1)) + +h(x); +>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19)) +>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10)) + +h({ a: '', b: '' }) +>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19)) +>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 3)) +>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 10)) + diff --git a/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.types b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.types new file mode 100644 index 00000000000..a860897d1fa --- /dev/null +++ b/tests/baselines/reference/errorsOnUnionsOfOverlappingObjects01.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts === +interface Foo { + a: string; +>a : string + + b: number; +>b : number + +}; + +interface Bar { + b: string; +>b : string +} + +interface Other { + totallyUnrelatedProperty: number; +>totallyUnrelatedProperty : number +} + +export let x = { a: '', b: '' }; +>x : { a: string; b: string; } +>{ a: '', b: '' } : { a: string; b: string; } +>a : string +>'' : "" +>b : string +>'' : "" + +declare function f(x: Foo | Other): any; +>f : (x: Foo | Other) => any +>x : Foo | Other + +f(x); +>f(x) : any +>f : (x: Foo | Other) => any +>x : { a: string; b: string; } + +f({ a: '', b: '' }) +>f({ a: '', b: '' }) : any +>f : (x: Foo | Other) => any +>{ a: '', b: '' } : { a: string; b: string; } +>a : string +>'' : "" +>b : string +>'' : "" + +declare function g(x: Bar | Other): any; +>g : (x: Bar | Other) => any +>x : Bar | Other + +g(x); +>g(x) : any +>g : (x: Bar | Other) => any +>x : { a: string; b: string; } + +g({ a: '', b: '' }) +>g({ a: '', b: '' }) : any +>g : (x: Bar | Other) => any +>{ a: '', b: '' } : { a: string; b: string; } +>a : string +>'' : "" +>b : string +>'' : "" + +declare function h(x: Foo | Bar | Other): any; +>h : (x: Foo | Bar | Other) => any +>x : Foo | Bar | Other + +h(x); +>h(x) : any +>h : (x: Foo | Bar | Other) => any +>x : { a: string; b: string; } + +h({ a: '', b: '' }) +>h({ a: '', b: '' }) : any +>h : (x: Foo | Bar | Other) => any +>{ a: '', b: '' } : { a: string; b: string; } +>a : string +>'' : "" +>b : string +>'' : "" + diff --git a/tests/baselines/reference/excessPropertyCheckWithUnions.errors.txt b/tests/baselines/reference/excessPropertyCheckWithUnions.errors.txt index 958bf059324..a4c5e2bc2f5 100644 --- a/tests/baselines/reference/excessPropertyCheckWithUnions.errors.txt +++ b/tests/baselines/reference/excessPropertyCheckWithUnions.errors.txt @@ -14,9 +14,9 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(39,1): error TS2322: Type Types of property 'tag' are incompatible. Type '"A"' is not assignable to type '"C"'. tests/cases/compiler/excessPropertyCheckWithUnions.ts(40,1): error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type 'Ambiguous'. - Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "C"; }'. + Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "B"; z: boolean; }'. Types of property 'tag' are incompatible. - Type '"A"' is not assignable to type '"C"'. + Type '"A"' is not assignable to type '"B"'. tests/cases/compiler/excessPropertyCheckWithUnions.ts(49,35): error TS2322: Type '{ a: 1; b: 1; first: string; second: string; }' is not assignable to type 'Overlapping'. Object literal may only specify known properties, and 'second' does not exist in type '{ a: 1; b: 1; first: string; }'. tests/cases/compiler/excessPropertyCheckWithUnions.ts(50,35): error TS2322: Type '{ a: 1; b: 1; first: string; third: string; }' is not assignable to type 'Overlapping'. @@ -92,9 +92,9 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(66,9): error TS2322: Type amb = { tag: "A", z: true } ~~~ !!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type 'Ambiguous'. -!!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "C"; }'. +!!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "B"; z: boolean; }'. !!! error TS2322: Types of property 'tag' are incompatible. -!!! error TS2322: Type '"A"' is not assignable to type '"C"'. +!!! error TS2322: Type '"A"' is not assignable to type '"B"'. type Overlapping = | { a: 1, b: 1, first: string } diff --git a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt index 62ddfd497a3..32772fa8533 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt +++ b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt @@ -6,9 +6,8 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(20,1): e Property 'a' is missing in type 'B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. Type 'A' is not assignable to type '(A & B) | (C & D)'. - Type 'A' is not assignable to type 'C & D'. - Type 'A' is not assignable to type 'C'. - Property 'c' is missing in type 'A'. + Type 'A' is not assignable to type 'A & B'. + Type 'A' is not assignable to type 'B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type 'C & D'. @@ -35,14 +34,15 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): e Type 'A & B' is not assignable to type 'D'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. - Type 'A' is not assignable to type 'B & D'. - Type 'A' is not assignable to type 'B'. + Type 'A' is not assignable to type 'A & D'. + Type 'A' is not assignable to type 'D'. + Property 'd' is missing in type 'A'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. Type 'C & D' is not assignable to type 'B & D'. Type 'C & D' is not assignable to type 'B'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. - Type 'C' is not assignable to type 'B & D'. + Type 'C' is not assignable to type 'B & C'. Type 'C' is not assignable to type 'B'. Property 'b' is missing in type 'C'. tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'A & B'. @@ -90,9 +90,8 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e ~ !!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. !!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'. -!!! error TS2322: Type 'A' is not assignable to type 'C & D'. -!!! error TS2322: Type 'A' is not assignable to type 'C'. -!!! error TS2322: Property 'c' is missing in type 'A'. +!!! error TS2322: Type 'A' is not assignable to type 'A & B'. +!!! error TS2322: Type 'A' is not assignable to type 'B'. x = cnd; // Ok x = cod; ~ @@ -135,8 +134,9 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e ~ !!! error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. !!! error TS2322: Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. -!!! error TS2322: Type 'A' is not assignable to type 'B & D'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Type 'A' is not assignable to type 'A & D'. +!!! error TS2322: Type 'A' is not assignable to type 'D'. +!!! error TS2322: Property 'd' is missing in type 'A'. y = cnd; ~ !!! error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. @@ -146,7 +146,7 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e ~ !!! error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. !!! error TS2322: Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'. -!!! error TS2322: Type 'C' is not assignable to type 'B & D'. +!!! error TS2322: Type 'C' is not assignable to type 'B & C'. !!! error TS2322: Type 'C' is not assignable to type 'B'. !!! error TS2322: Property 'b' is missing in type 'C'. anb = y; diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt index d481b88810c..2153bae6e86 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt @@ -6,8 +6,11 @@ tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(19,1): error TS2 tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is not assignable to type 'Property'. Types of property 'parent' are incompatible. Type 'Namespace' is not assignable to type 'Module | Class'. - Type 'Namespace' is not assignable to type 'Class'. - Property 'parent' is missing in type 'Namespace'. + Type 'Namespace' is not assignable to type 'Module'. + Types of property 'members' are incompatible. + Type '(Class | Property)[]' is not assignable to type 'Class[]'. + Type 'Class | Property' is not assignable to type 'Class'. + Type 'Property' is not assignable to type 'Class'. ==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ==== @@ -41,6 +44,9 @@ tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2 !!! error TS2322: Type 'Class' is not assignable to type 'Property'. !!! error TS2322: Types of property 'parent' are incompatible. !!! error TS2322: Type 'Namespace' is not assignable to type 'Module | Class'. -!!! error TS2322: Type 'Namespace' is not assignable to type 'Class'. -!!! error TS2322: Property 'parent' is missing in type 'Namespace'. +!!! error TS2322: Type 'Namespace' is not assignable to type 'Module'. +!!! error TS2322: Types of property 'members' are incompatible. +!!! error TS2322: Type '(Class | Property)[]' is not assignable to type 'Class[]'. +!!! error TS2322: Type 'Class | Property' is not assignable to type 'Class'. +!!! error TS2322: Type 'Property' is not assignable to type 'Class'. \ No newline at end of file From 96f9e076f88ec27a4ddfa95a39e815b1f2c8ba41 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 26 Sep 2018 13:50:37 -0700 Subject: [PATCH 007/294] Don't implicit-any diagnostic for json module --- src/compiler/checker.ts | 2 +- ...xCannotFindModule_suggestion_falsePositive.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a66a7edcf18..495b85fc05f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2241,7 +2241,7 @@ namespace ts { const sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { - if (resolvedModule.isExternalLibraryImport && !extensionIsTS(resolvedModule.extension)) { + if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) { errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference); } // merged symbol is module declaration symbol combined with all augmentations diff --git a/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts b/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts new file mode 100644 index 00000000000..123d59d82a3 --- /dev/null +++ b/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts @@ -0,0 +1,16 @@ +/// + +// @moduleResolution: node +// @resolveJsonModule: true +// @strict: true + +// @Filename: /node_modules/foo/bar.json +////export const x = 0; + +// @Filename: /a.ts +////import abs = require([|"foo/bar.json"|]); +////abs; + +verify.noErrors(); +goTo.file("/a.ts"); +verify.getSuggestionDiagnostics([]); From 7b1388b071cc87d0618e4aeebf46c8ff09134f39 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 26 Sep 2018 16:05:12 -0700 Subject: [PATCH 008/294] Ensure verify.noErrors tests json files --- src/harness/fourslash.ts | 3 ++- .../codeFixCannotFindModule_suggestion_falsePositive.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c06e95339f1..1c32d5dda4c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -593,7 +593,8 @@ namespace FourSlash { public verifyNoErrors() { ts.forEachKey(this.inputFiles, fileName => { if (!ts.isAnySupportedFileExtension(fileName) - || !this.getProgram().getCompilerOptions().allowJs && !ts.extensionIsTS(ts.extensionFromPath(fileName))) return; + || Harness.getConfigNameFromFileName(fileName) + || !this.getProgram().getCompilerOptions().allowJs && !ts.resolutionExtensionIsTSOrJson(ts.extensionFromPath(fileName))) return; const errors = this.getDiagnostics(fileName).filter(e => e.category !== ts.DiagnosticCategory.Suggestion); if (errors.length) { this.printErrorLog(/*expectErrors*/ false, errors); diff --git a/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts b/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts index 123d59d82a3..54afae7c4d1 100644 --- a/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts +++ b/tests/cases/fourslash/codeFixCannotFindModule_suggestion_falsePositive.ts @@ -5,7 +5,7 @@ // @strict: true // @Filename: /node_modules/foo/bar.json -////export const x = 0; +////{ "a": 0 } // @Filename: /a.ts ////import abs = require([|"foo/bar.json"|]); From 6bd9b766b38939a5fdcfd732dbcd690eb6e30e0a Mon Sep 17 00:00:00 2001 From: iliashkolyar Date: Sun, 7 Oct 2018 22:19:09 +0300 Subject: [PATCH 009/294] Code review - remove 'isCallExpression' check --- .../codefixes/fixAddMissingNewOperator.ts | 8 +++--- .../cases/fourslash/codeFixAddMissingNew5.ts | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/codeFixAddMissingNew5.ts diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index ce68659be72..5acaf6eb82e 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -16,11 +16,9 @@ namespace ts.codefix { function addMissingNewOperator(changes: textChanges.ChangeTracker, sourceFile: SourceFile, span: TextSpan): void { const call = cast(findAncestorMatchingSpan(sourceFile, span), isCallExpression); - changes.insertNodeAt(sourceFile, span.start, createToken(SyntaxKind.NewKeyword), { suffix: " " }); - if (isCallExpression(call.expression)) { - changes.insertNodeAt(sourceFile, call.expression.getStart(sourceFile), createToken(SyntaxKind.OpenParenToken)); - changes.insertNodeAt(sourceFile, call.expression.end, createToken(SyntaxKind.CloseParenToken)); - } + const newExpression = createNew(call.expression, call.typeArguments, call.arguments); + + changes.replaceNode(sourceFile, call, newExpression); } function findAncestorMatchingSpan(sourceFile: SourceFile, span: TextSpan): Node { diff --git a/tests/cases/fourslash/codeFixAddMissingNew5.ts b/tests/cases/fourslash/codeFixAddMissingNew5.ts new file mode 100644 index 00000000000..ecc5509a18a --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingNew5.ts @@ -0,0 +1,25 @@ +/// + +////class C { +////} +//// +////function foo() { +//// return C; +////} +//// +////foo()!(); + + +verify.codeFix({ + description: "Add missing 'new' operator to call", + index: 0, + newFileContent: +`class C { +} + +function foo() { + return C; +} + +new (foo()!)();` +}); From 093315570619526234a690ee626b6af6b262b0bb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 9 Oct 2018 16:03:31 -0700 Subject: [PATCH 010/294] Always emit related diagnostic when a call expression can be fixed by adding a semicolon --- src/compiler/checker.ts | 2 +- .../betterErrorForAccidentalCall.errors.txt | 39 +++++++++++++++++++ ...ons.js => betterErrorForAccidentalCall.js} | 12 +++--- .../betterErrorForAccidentalCall.symbols | 25 ++++++++++++ ...pes => betterErrorForAccidentalCall.types} | 23 +++++------ ...CallingTypeAssertionExpressions.errors.txt | 39 ------------------- ...llyCallingTypeAssertionExpressions.symbols | 25 ------------ ...ons.ts => betterErrorForAccidentalCall.ts} | 6 +-- 8 files changed, 86 insertions(+), 85 deletions(-) create mode 100644 tests/baselines/reference/betterErrorForAccidentalCall.errors.txt rename tests/baselines/reference/{betterErrorForAccidentallyCallingTypeAssertionExpressions.js => betterErrorForAccidentalCall.js} (53%) create mode 100644 tests/baselines/reference/betterErrorForAccidentalCall.symbols rename tests/baselines/reference/{betterErrorForAccidentallyCallingTypeAssertionExpressions.types => betterErrorForAccidentalCall.types} (65%) delete mode 100644 tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.errors.txt delete mode 100644 tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.symbols rename tests/cases/compiler/{betterErrorForAccidentallyCallingTypeAssertionExpressions.ts => betterErrorForAccidentalCall.ts} (77%) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fe2ce42652a..0632af424aa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20046,7 +20046,7 @@ namespace ts { } else { let relatedInformation: DiagnosticRelatedInformation | undefined; - if (node.arguments.length === 1 && isTypeAssertion(first(node.arguments))) { + if (node.arguments.length === 1) { const text = getSourceFileOfNode(node).text; if (isLineBreak(text.charCodeAt(skipTrivia(text, node.expression.end, /* stopAfterLineBreak */ true) - 1))) { relatedInformation = createDiagnosticForNode(node.expression, Diagnostics.It_is_highly_likely_that_you_are_missing_a_semicolon); diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt new file mode 100644 index 00000000000..f5358b45a4f --- /dev/null +++ b/tests/baselines/reference/betterErrorForAccidentalCall.errors.txt @@ -0,0 +1,39 @@ +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 (5 errors) ==== + declare function foo(): string; + + foo()(1 as number).toString(); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible 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. + + foo() + ~~~~~ + (1 as number).toString(); + ~~~~~~~~~~~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible 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. +!!! 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. +!!! 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/betterErrorForAccidentallyCallingTypeAssertionExpressions.js b/tests/baselines/reference/betterErrorForAccidentalCall.js similarity index 53% rename from tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.js rename to tests/baselines/reference/betterErrorForAccidentalCall.js index 877ed539e71..deb2b22d2f6 100644 --- a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.js +++ b/tests/baselines/reference/betterErrorForAccidentalCall.js @@ -1,4 +1,4 @@ -//// [betterErrorForAccidentallyCallingTypeAssertionExpressions.ts] +//// [betterErrorForAccidentalCall.ts] declare function foo(): string; foo()(1 as number).toString(); @@ -8,16 +8,16 @@ foo() (1 as number).toString(); foo() (1 as number).toString(); -foo() - (1 as number).toString(); +foo() + (1 + 2).toString(); -foo() +foo() (1).toString(); -//// [betterErrorForAccidentallyCallingTypeAssertionExpressions.js] -foo()(1).toString(); +//// [betterErrorForAccidentalCall.js] foo()(1).toString(); foo()(1).toString(); foo()(1).toString(); +foo()(1 + 2).toString(); foo()(1).toString(); diff --git a/tests/baselines/reference/betterErrorForAccidentalCall.symbols b/tests/baselines/reference/betterErrorForAccidentalCall.symbols new file mode 100644 index 00000000000..9471b0bb060 --- /dev/null +++ b/tests/baselines/reference/betterErrorForAccidentalCall.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/betterErrorForAccidentalCall.ts === +declare function foo(): string; +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + +foo()(1 as number).toString(); +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + +foo() (1 as number).toString(); +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + +foo() +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + +(1 as number).toString(); + +foo() +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + + (1 + 2).toString(); + +foo() +>foo : Symbol(foo, Decl(betterErrorForAccidentalCall.ts, 0, 0)) + + (1).toString(); + diff --git a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.types b/tests/baselines/reference/betterErrorForAccidentalCall.types similarity index 65% rename from tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.types rename to tests/baselines/reference/betterErrorForAccidentalCall.types index 54564d7462c..1a3dfbd47f3 100644 --- a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.types +++ b/tests/baselines/reference/betterErrorForAccidentalCall.types @@ -1,4 +1,4 @@ -=== tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts === +=== tests/cases/compiler/betterErrorForAccidentalCall.ts === declare function foo(): string; >foo : () => string @@ -34,22 +34,23 @@ foo() >1 : 1 >toString : any -foo() ->foo() (1 as number).toString() : any ->foo() (1 as number).toString : any ->foo() (1 as number) : any +foo() +>foo() (1 + 2).toString() : any +>foo() (1 + 2).toString : any +>foo() (1 + 2) : any >foo() : string >foo : () => string - (1 as number).toString(); ->1 as number : number + (1 + 2).toString(); +>1 + 2 : number >1 : 1 +>2 : 2 >toString : any -foo() ->foo() (1).toString() : any ->foo() (1).toString : any ->foo() (1) : any +foo() +>foo() (1).toString() : any +>foo() (1).toString : any +>foo() (1) : any >foo() : string >foo : () => string diff --git a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.errors.txt b/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.errors.txt deleted file mode 100644 index 023e40a70da..00000000000 --- a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts (5 errors) ==== - declare function foo(): string; - - foo()(1 as number).toString(); - ~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible 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. - - foo() - ~~~~~ - (1 as number).toString(); - ~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -!!! related TS2734 tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts:7:1: It is highly likely that you are missing a semicolon. - - foo() - ~~~~~~~~ - (1 as number).toString(); - ~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. -!!! related TS2734 tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.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. -!!! related TS2734 tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.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/betterErrorForAccidentallyCallingTypeAssertionExpressions.symbols b/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.symbols deleted file mode 100644 index 9dc2e676937..00000000000 --- a/tests/baselines/reference/betterErrorForAccidentallyCallingTypeAssertionExpressions.symbols +++ /dev/null @@ -1,25 +0,0 @@ -=== tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts === -declare function foo(): string; ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - -foo()(1 as number).toString(); ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - -foo() (1 as number).toString(); ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - -foo() ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - -(1 as number).toString(); - -foo() ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - - (1 as number).toString(); - -foo() ->foo : Symbol(foo, Decl(betterErrorForAccidentallyCallingTypeAssertionExpressions.ts, 0, 0)) - - (1).toString(); - diff --git a/tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts b/tests/cases/compiler/betterErrorForAccidentalCall.ts similarity index 77% rename from tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts rename to tests/cases/compiler/betterErrorForAccidentalCall.ts index 42c3025c8e3..e8303965ce0 100644 --- a/tests/cases/compiler/betterErrorForAccidentallyCallingTypeAssertionExpressions.ts +++ b/tests/cases/compiler/betterErrorForAccidentalCall.ts @@ -7,8 +7,8 @@ foo() (1 as number).toString(); foo() (1 as number).toString(); -foo() - (1 as number).toString(); +foo() + (1 + 2).toString(); -foo() +foo() (1).toString(); From 8ff539245c84f68e25f85e2c178c67f9a97781e9 Mon Sep 17 00:00:00 2001 From: Prateek Goel Date: Sat, 20 Oct 2018 23:58:59 +0530 Subject: [PATCH 011/294] Error messages for extending a specific type --- src/compiler/checker.ts | 4 ++-- src/compiler/diagnosticMessages.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 327004f776d..f8f97be48cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5831,7 +5831,7 @@ namespace ts { } } else { - error(node, Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + error(node, Diagnostics.An_interface_can_only_extend_an_object_or_intersection_type_with_statically_known_members); } } } @@ -25979,7 +25979,7 @@ namespace ts { } } else { - error(typeRefNode, Diagnostics.A_class_may_only_implement_another_class_or_interface); + error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_or_intersection_type_with_statically_known_members); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 558c45bf2af..4175b3151c0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1056,7 +1056,7 @@ "category": "Error", "code": 2311 }, - "An interface may only extend a class or another interface.": { + "An interface can only extend an object or intersection type with statically known members.": { "category": "Error", "code": 2312 }, @@ -1484,7 +1484,7 @@ "category": "Error", "code": 2420 }, - "A class may only implement another class or interface.": { + "A class can only implement an object or intersection type with statically known members.": { "category": "Error", "code": 2422 }, From 1666a561bc20afdc09507a2c53ae76fc0ef42d3b Mon Sep 17 00:00:00 2001 From: Prateek Goel Date: Sun, 21 Oct 2018 23:19:34 +0530 Subject: [PATCH 012/294] Error messages and tests --- src/compiler/checker.ts | 6 +++--- src/compiler/diagnosticMessages.json | 6 +++--- .../reference/inheritFromGenericTypeParameter.errors.txt | 4 ++-- .../interfaceExtendsObjectIntersectionErrors.errors.txt | 8 ++++---- .../reference/typeParameterAsBaseClass.errors.txt | 4 ++-- .../reference/typeParameterAsBaseType.errors.txt | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f8f97be48cb..2ead8d36b00 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5773,7 +5773,7 @@ namespace ts { return type.resolvedBaseTypes = emptyArray; } if (!isValidBaseType(baseType)) { - error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); + error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(baseType)); return type.resolvedBaseTypes = emptyArray; } if (type === baseType || hasBaseType(baseType, type)) { @@ -5831,7 +5831,7 @@ namespace ts { } } else { - error(node, Diagnostics.An_interface_can_only_extend_an_object_or_intersection_type_with_statically_known_members); + error(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } } @@ -25979,7 +25979,7 @@ namespace ts { } } else { - error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_or_intersection_type_with_statically_known_members); + error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4175b3151c0..ea294b6397b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1056,7 +1056,7 @@ "category": "Error", "code": 2311 }, - "An interface can only extend an object or intersection type with statically known members.": { + "An interface can only extend an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2312 }, @@ -1484,7 +1484,7 @@ "category": "Error", "code": 2420 }, - "A class can only implement an object or intersection type with statically known members.": { + "A class can only implement an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2422 }, @@ -1816,7 +1816,7 @@ "category": "Error", "code": 2508 }, - "Base constructor return type '{0}' is not a class or interface type.": { + "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2509 }, diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt index c043e37575c..f0618a06253 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2304: Cannot find name 'T'. -tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface may only extend a class or another interface. +tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/compiler/inheritFromGenericTypeParameter.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An !!! error TS2304: Cannot find name 'T'. interface I extends T { } ~ -!!! error TS2312: An interface may only extend a class or another interface. \ No newline at end of file +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt b/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt index 87faadeb4a6..17cb5585cf8 100644 --- a/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt +++ b/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt @@ -51,8 +51,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI Type 'I23' is not assignable to type 'T1'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface may only extend a class or another interface. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface may only extend a class or another interface. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts (23 errors) ==== @@ -177,8 +177,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI interface I30 extends U { x: string } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. interface I31 extends T { x: string } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsBaseClass.errors.txt b/tests/baselines/reference/typeParameterAsBaseClass.errors.txt index dec7f7f2a4a..9a8706b4c93 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.errors.txt +++ b/tests/baselines/reference/typeParameterAsBaseClass.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeParameterAsBaseClass.ts(1,20): error TS2304: Cannot find name 'T'. -tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class may only implement another class or interface. +tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class can only implement an object type or intersection of object types with statically known members. ==== tests/cases/compiler/typeParameterAsBaseClass.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class ma !!! error TS2304: Cannot find name 'T'. class C2 implements T {} ~ -!!! error TS2422: A class may only implement another class or interface. \ No newline at end of file +!!! error TS2422: A class can only implement an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsBaseType.errors.txt b/tests/baselines/reference/typeParameterAsBaseType.errors.txt index 835b2369948..63a1ab8bd14 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.errors.txt +++ b/tests/baselines/reference/typeParameterAsBaseType.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(4,20): error TS2304: Cannot find name 'T'. tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(5,24): error TS2304: Cannot find name 'U'. -tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface may only extend a class or another interface. -tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface may only extend a class or another interface. +tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. +tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts (4 errors) ==== @@ -17,9 +17,9 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): e interface I extends T { } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. interface I2 extends U { } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file From d45eed314a47c56af24313c5108431997bd064b9 Mon Sep 17 00:00:00 2001 From: Prateek Goel Date: Sat, 20 Oct 2018 23:58:59 +0530 Subject: [PATCH 013/294] Error messages for extending a specific type --- src/compiler/checker.ts | 4 ++-- src/compiler/diagnosticMessages.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 327004f776d..f8f97be48cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5831,7 +5831,7 @@ namespace ts { } } else { - error(node, Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + error(node, Diagnostics.An_interface_can_only_extend_an_object_or_intersection_type_with_statically_known_members); } } } @@ -25979,7 +25979,7 @@ namespace ts { } } else { - error(typeRefNode, Diagnostics.A_class_may_only_implement_another_class_or_interface); + error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_or_intersection_type_with_statically_known_members); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 558c45bf2af..4175b3151c0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1056,7 +1056,7 @@ "category": "Error", "code": 2311 }, - "An interface may only extend a class or another interface.": { + "An interface can only extend an object or intersection type with statically known members.": { "category": "Error", "code": 2312 }, @@ -1484,7 +1484,7 @@ "category": "Error", "code": 2420 }, - "A class may only implement another class or interface.": { + "A class can only implement an object or intersection type with statically known members.": { "category": "Error", "code": 2422 }, From 2fa23e96cd13da64dbc1429ff11fc62c9a2eb8e6 Mon Sep 17 00:00:00 2001 From: Prateek Goel Date: Sun, 21 Oct 2018 23:19:34 +0530 Subject: [PATCH 014/294] Error messages and tests --- src/compiler/checker.ts | 6 +++--- src/compiler/diagnosticMessages.json | 6 +++--- .../reference/inheritFromGenericTypeParameter.errors.txt | 4 ++-- .../interfaceExtendsObjectIntersectionErrors.errors.txt | 8 ++++---- .../reference/typeParameterAsBaseClass.errors.txt | 4 ++-- .../reference/typeParameterAsBaseType.errors.txt | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f8f97be48cb..2ead8d36b00 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5773,7 +5773,7 @@ namespace ts { return type.resolvedBaseTypes = emptyArray; } if (!isValidBaseType(baseType)) { - error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); + error(baseTypeNode.expression, Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(baseType)); return type.resolvedBaseTypes = emptyArray; } if (type === baseType || hasBaseType(baseType, type)) { @@ -5831,7 +5831,7 @@ namespace ts { } } else { - error(node, Diagnostics.An_interface_can_only_extend_an_object_or_intersection_type_with_statically_known_members); + error(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } } @@ -25979,7 +25979,7 @@ namespace ts { } } else { - error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_or_intersection_type_with_statically_known_members); + error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4175b3151c0..ea294b6397b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1056,7 +1056,7 @@ "category": "Error", "code": 2311 }, - "An interface can only extend an object or intersection type with statically known members.": { + "An interface can only extend an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2312 }, @@ -1484,7 +1484,7 @@ "category": "Error", "code": 2420 }, - "A class can only implement an object or intersection type with statically known members.": { + "A class can only implement an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2422 }, @@ -1816,7 +1816,7 @@ "category": "Error", "code": 2508 }, - "Base constructor return type '{0}' is not a class or interface type.": { + "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members.": { "category": "Error", "code": 2509 }, diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt index c043e37575c..f0618a06253 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritFromGenericTypeParameter.ts(1,20): error TS2304: Cannot find name 'T'. -tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface may only extend a class or another interface. +tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/compiler/inheritFromGenericTypeParameter.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/inheritFromGenericTypeParameter.ts(2,24): error TS2312: An !!! error TS2304: Cannot find name 'T'. interface I extends T { } ~ -!!! error TS2312: An interface may only extend a class or another interface. \ No newline at end of file +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt b/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt index 87faadeb4a6..17cb5585cf8 100644 --- a/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt +++ b/tests/baselines/reference/interfaceExtendsObjectIntersectionErrors.errors.txt @@ -51,8 +51,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI Type 'I23' is not assignable to type 'T1'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface may only extend a class or another interface. -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface may only extend a class or another interface. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(46,23): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts(47,26): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersectionErrors.ts (23 errors) ==== @@ -177,8 +177,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectI interface I30 extends U { x: string } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. interface I31 extends T { x: string } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsBaseClass.errors.txt b/tests/baselines/reference/typeParameterAsBaseClass.errors.txt index dec7f7f2a4a..9a8706b4c93 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.errors.txt +++ b/tests/baselines/reference/typeParameterAsBaseClass.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeParameterAsBaseClass.ts(1,20): error TS2304: Cannot find name 'T'. -tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class may only implement another class or interface. +tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class can only implement an object type or intersection of object types with statically known members. ==== tests/cases/compiler/typeParameterAsBaseClass.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/typeParameterAsBaseClass.ts(2,24): error TS2422: A class ma !!! error TS2304: Cannot find name 'T'. class C2 implements T {} ~ -!!! error TS2422: A class may only implement another class or interface. \ No newline at end of file +!!! error TS2422: A class can only implement an object type or intersection of object types with statically known members. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsBaseType.errors.txt b/tests/baselines/reference/typeParameterAsBaseType.errors.txt index 835b2369948..63a1ab8bd14 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.errors.txt +++ b/tests/baselines/reference/typeParameterAsBaseType.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(4,20): error TS2304: Cannot find name 'T'. tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(5,24): error TS2304: Cannot find name 'U'. -tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface may only extend a class or another interface. -tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface may only extend a class or another interface. +tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(7,24): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. +tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): error TS2312: An interface can only extend an object type or intersection of object types with statically known members. ==== tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts (4 errors) ==== @@ -17,9 +17,9 @@ tests/cases/conformance/types/typeParameters/typeParameterAsBaseType.ts(8,28): e interface I extends T { } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. interface I2 extends U { } ~ -!!! error TS2312: An interface may only extend a class or another interface. +!!! error TS2312: An interface can only extend an object type or intersection of object types with statically known members. \ No newline at end of file From 09d5aa698a2a180548b1e9f9985dbec327c1f5b1 Mon Sep 17 00:00:00 2001 From: Leon Aves Date: Wed, 31 Oct 2018 18:05:43 +0000 Subject: [PATCH 015/294] Fix broken twitter link in README Was using old hashbang style URL. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8b068bbab8..a7222668ada 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob * [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. * Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). * Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript). -* Join the [#typescript](https://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter. * [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). * Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), [pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)). From 28fc0a28b0b77066746dbedb1441f27449a2cb60 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 2 Nov 2018 17:43:13 +0200 Subject: [PATCH 016/294] add new error message 'Cannot assign to {0} because it is a constant.' --- src/compiler/checker.ts | 7 +- src/compiler/diagnosticMessages.json | 4 ++ .../constDeclarations-access.errors.txt | 4 +- .../constDeclarations-access2.errors.txt | 68 +++++++++---------- .../constDeclarations-errors.errors.txt | 4 +- .../reference/constWithNonNull.errors.txt | 4 +- tests/baselines/reference/for-of2.errors.txt | 4 +- .../reference/redefineArray.errors.txt | 4 +- 8 files changed, 54 insertions(+), 45 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7df0414b90b..3c99001be1b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15891,7 +15891,12 @@ namespace ts { return errorType; } if (isReadonlySymbol(localOrExportSymbol)) { - error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol)); + if (localOrExportSymbol.flags & SymbolFlags.Variable) { + error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); + } + else { + error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol)); + } return errorType; } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e2dd0a1b7cd..4b6d97b5332 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2124,6 +2124,10 @@ "category": "Error", "code": 2587 }, + "Cannot assign to '{0}' because it is a constant.": { + "category": "Error", + "code": 2588 + }, "JSX element attributes type '{0}' may not be a union type.": { "category": "Error", "code": 2600 diff --git a/tests/baselines/reference/constDeclarations-access.errors.txt b/tests/baselines/reference/constDeclarations-access.errors.txt index c9c730456e2..4accefa01bc 100644 --- a/tests/baselines/reference/constDeclarations-access.errors.txt +++ b/tests/baselines/reference/constDeclarations-access.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/file2.ts(1,1): error TS2588: Cannot assign to 'x' because it is a constant. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/file2.ts(1,1): error TS2540: Cannot assign to 'x' because i ==== tests/cases/compiler/file2.ts (1 errors) ==== x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. \ No newline at end of file +!!! error TS2588: Cannot assign to 'x' because it is a constant. \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-access2.errors.txt b/tests/baselines/reference/constDeclarations-access2.errors.txt index dc8b4d5b90b..dfb796e25fd 100644 --- a/tests/baselines/reference/constDeclarations-access2.errors.txt +++ b/tests/baselines/reference/constDeclarations-access2.errors.txt @@ -1,20 +1,20 @@ -tests/cases/compiler/constDeclarations-access2.ts(4,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(17,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/constDeclarations-access2.ts(4,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(5,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(6,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(7,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(8,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(9,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(10,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(11,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(12,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(13,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(14,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(15,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(17,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(18,1): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(19,3): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(20,3): error TS2588: Cannot assign to 'x' because it is a constant. +tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2588: Cannot assign to 'x' because it is a constant. ==== tests/cases/compiler/constDeclarations-access2.ts (17 errors) ==== @@ -23,57 +23,57 @@ tests/cases/compiler/constDeclarations-access2.ts(22,5): error TS2540: Cannot as // Errors x = 1; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x += 2; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x -= 3; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x *= 4; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x /= 5; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x %= 6; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x <<= 7; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x >>= 8; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x >>>= 9; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x &= 10; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x |= 11; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x ^= 12; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. x--; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. ++x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. --x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. ++((x)); ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. // OK var a = x + 1; diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index 52579561707..d945ce10aa5 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/constDeclarations-errors.ts(4,7): error TS1155: 'const' dec tests/cases/compiler/constDeclarations-errors.ts(4,11): error TS1155: 'const' declarations must be initialized. tests/cases/compiler/constDeclarations-errors.ts(4,15): error TS1155: 'const' declarations must be initialized. tests/cases/compiler/constDeclarations-errors.ts(4,27): error TS1155: 'const' declarations must be initialized. -tests/cases/compiler/constDeclarations-errors.ts(9,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property. +tests/cases/compiler/constDeclarations-errors.ts(9,27): error TS2588: Cannot assign to 'c8' because it is a constant. tests/cases/compiler/constDeclarations-errors.ts(12,11): error TS1155: 'const' declarations must be initialized. tests/cases/compiler/constDeclarations-errors.ts(15,20): error TS1155: 'const' declarations must be initialized. @@ -32,7 +32,7 @@ tests/cases/compiler/constDeclarations-errors.ts(15,20): error TS1155: 'const' d // error, assigning to a const for(const c8 = 0; c8 < 1; c8++) { } ~~ -!!! error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'c8' because it is a constant. // error, can not be unintalized for(const c9; c9 < 1;) { } diff --git a/tests/baselines/reference/constWithNonNull.errors.txt b/tests/baselines/reference/constWithNonNull.errors.txt index 58667c417da..840b26c5f35 100644 --- a/tests/baselines/reference/constWithNonNull.errors.txt +++ b/tests/baselines/reference/constWithNonNull.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/constWithNonNull.ts(4,1): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/constWithNonNull.ts(4,1): error TS2588: Cannot assign to 'x' because it is a constant. ==== tests/cases/compiler/constWithNonNull.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/constWithNonNull.ts(4,1): error TS2540: Cannot assign to 'x declare const x: number | undefined; x!++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2588: Cannot assign to 'x' because it is a constant. \ No newline at end of file diff --git a/tests/baselines/reference/for-of2.errors.txt b/tests/baselines/reference/for-of2.errors.txt index 3bf3b679898..f1ff169a58e 100644 --- a/tests/baselines/reference/for-of2.errors.txt +++ b/tests/baselines/reference/for-of2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized. -tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2540: Cannot assign to 'v' because it is a constant or a read-only property. +tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2588: Cannot assign to 'v' because it is a constant. ==== tests/cases/conformance/es6/for-ofStatements/for-of2.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2540: Cann !!! error TS1155: 'const' declarations must be initialized. for (v of []) { } ~ -!!! error TS2540: Cannot assign to 'v' because it is a constant or a read-only property. \ No newline at end of file +!!! error TS2588: Cannot assign to 'v' because it is a constant. \ No newline at end of file diff --git a/tests/baselines/reference/redefineArray.errors.txt b/tests/baselines/reference/redefineArray.errors.txt index 6a9cf954798..dd3727b0216 100644 --- a/tests/baselines/reference/redefineArray.errors.txt +++ b/tests/baselines/reference/redefineArray.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/redefineArray.ts(1,1): error TS2540: Cannot assign to 'Array' because it is a constant or a read-only property. +tests/cases/compiler/redefineArray.ts(1,1): error TS2588: Cannot assign to 'Array' because it is a constant. ==== tests/cases/compiler/redefineArray.ts (1 errors) ==== Array = function (n:number, s:string) {return n;}; ~~~~~ -!!! error TS2540: Cannot assign to 'Array' because it is a constant or a read-only property. \ No newline at end of file +!!! error TS2588: Cannot assign to 'Array' because it is a constant. \ No newline at end of file From ae8d54658a9a16231bef13bb25d0634d7c99151e Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 3 Nov 2018 16:07:20 +0200 Subject: [PATCH 017/294] exclude mention about constant from error message 'a-constant-or-a-read-only-property' to be more specific. --- src/compiler/checker.ts | 6 +++--- src/compiler/diagnosticMessages.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3c99001be1b..960461ca2fc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9339,7 +9339,7 @@ namespace ts { if (accessExpression) { markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === SyntaxKind.ThisKeyword); if (isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) { - error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop)); + error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); return missingType; } if (cacheSymbol) { @@ -15895,7 +15895,7 @@ namespace ts { error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); } else { - error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol)); + error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol)); } return errorType; } @@ -18468,7 +18468,7 @@ namespace ts { checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, apparentType, prop); if (assignmentKind) { if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) { - error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, idText(right)); + error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); return errorType; } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4b6d97b5332..c799bb08ff1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1944,7 +1944,7 @@ "category": "Error", "code": 2539 }, - "Cannot assign to '{0}' because it is a constant or a read-only property.": { + "Cannot assign to '{0}' because it is a read-only property.": { "category": "Error", "code": 2540 }, From 66539b4378990fabdc4caf37a6511db8a11d0a01 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 3 Nov 2018 16:10:56 +0200 Subject: [PATCH 018/294] accept baseline for changed error message #2540 --- .../abstractPropertyNegative.errors.txt | 4 +- .../reference/assignToEnum.errors.txt | 8 +-- .../reference/assignments.errors.txt | 4 +- ...heckExportsObjectAssignProperty.errors.txt | 16 ++--- ...tsObjectAssignPrototypeProperty.errors.txt | 8 +-- .../checkObjectDefineProperty.errors.txt | 12 ++-- .../checkOtherObjectAssignProperty.errors.txt | 12 ++-- .../reference/conditionalTypes1.errors.txt | 8 +-- .../constDeclarations-access3.errors.txt | 72 +++++++++---------- .../constDeclarations-access4.errors.txt | 72 +++++++++---------- .../constDeclarations-access5.errors.txt | 72 +++++++++---------- .../constEnumPropertyAccess2.errors.txt | 4 +- .../decrementOperatorWithEnumType.errors.txt | 12 ++-- .../reference/enumMergeWithExpando.errors.txt | 8 +-- ...externalModuleImmutableBindings.errors.txt | 64 ++++++++--------- .../importsImplicitlyReadonly.errors.txt | 8 +-- .../incrementOperatorWithEnumType.errors.txt | 16 ++--- .../intersectionTypeReadonly.errors.txt | 20 +++--- .../invalidUndefinedAssignments.errors.txt | 4 +- .../reference/mappedTypes6.errors.txt | 12 ++-- .../reference/objectFreeze.errors.txt | 4 +- .../nodeModulesMaxDepthExceeded.errors.txt | 4 +- .../nodeModulesMaxDepthExceeded.errors.txt | 4 +- ...mentInSubclassOfClassExpression.errors.txt | 4 +- .../readonlyConstructorAssignment.errors.txt | 4 +- ...readonlyInConstructorParameters.errors.txt | 4 +- .../reference/readonlyMembers.errors.txt | 52 +++++++------- .../reference/unionTypeReadonly.errors.txt | 16 ++--- .../unionTypeWithIndexSignature.errors.txt | 4 +- .../reference/validNullAssignments.errors.txt | 4 +- 30 files changed, 268 insertions(+), 268 deletions(-) diff --git a/tests/baselines/reference/abstractPropertyNegative.errors.txt b/tests/baselines/reference/abstractPropertyNegative.errors.txt index be1c85374fb..fd09b024213 100644 --- a/tests/baselines/reference/abstractPropertyNegative.errors.txt +++ b/tests/baselines/reference/abstractPropertyNegative.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstra tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'. tests/cases/compiler/abstractPropertyNegative.ts(15,5): error TS1244: Abstract methods can only appear within an abstract class. tests/cases/compiler/abstractPropertyNegative.ts(16,37): error TS1005: '{' expected. -tests/cases/compiler/abstractPropertyNegative.ts(19,3): error TS2540: Cannot assign to 'ro' because it is a constant or a read-only property. +tests/cases/compiler/abstractPropertyNegative.ts(19,3): error TS2540: Cannot assign to 'ro' because it is a read-only property. tests/cases/compiler/abstractPropertyNegative.ts(25,5): error TS2416: Property 'num' in type 'WrongTypePropertyImpl' is not assignable to the same property in base type 'WrongTypeProperty'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/abstractPropertyNegative.ts(31,9): error TS2416: Property 'num' in type 'WrongTypeAccessorImpl' is not assignable to the same property in base type 'WrongTypeAccessor'. @@ -56,7 +56,7 @@ tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors let c = new C(); c.ro = "error: lhs of assignment can't be readonly"; ~~ -!!! error TS2540: Cannot assign to 'ro' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'ro' because it is a read-only property. abstract class WrongTypeProperty { abstract num: number; diff --git a/tests/baselines/reference/assignToEnum.errors.txt b/tests/baselines/reference/assignToEnum.errors.txt index 438a002ef1e..53b4afc1864 100644 --- a/tests/baselines/reference/assignToEnum.errors.txt +++ b/tests/baselines/reference/assignToEnum.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignToEnum.ts(2,1): error TS2539: Cannot assign to 'A' because it is not a variable. tests/cases/compiler/assignToEnum.ts(3,1): error TS2539: Cannot assign to 'A' because it is not a variable. -tests/cases/compiler/assignToEnum.ts(4,3): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. -tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. +tests/cases/compiler/assignToEnum.ts(4,3): error TS2540: Cannot assign to 'foo' because it is a read-only property. +tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo' because it is a read-only property. ==== tests/cases/compiler/assignToEnum.ts (4 errors) ==== @@ -14,9 +14,9 @@ tests/cases/compiler/assignToEnum.ts(5,3): error TS2540: Cannot assign to 'foo' !!! error TS2539: Cannot assign to 'A' because it is not a variable. A.foo = 1; // invalid LHS ~~~ -!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'foo' because it is a read-only property. A.foo = A.bar; // invalid LHS ~~~ -!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'foo' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/assignments.errors.txt b/tests/baselines/reference/assignments.errors.txt index cb8b7a17bdf..19cdbd813a6 100644 --- a/tests/baselines/reference/assignments.errors.txt +++ b/tests/baselines/reference/assignments.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(11,1): error TS2708: Cannot use namespace 'M' as a value. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(14,1): error TS2539: Cannot assign to 'C' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(17,1): error TS2539: Cannot assign to 'E' because it is not a variable. -tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(18,3): error TS2540: Cannot assign to 'A' because it is a read-only property. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(21,1): error TS2539: Cannot assign to 'fn' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): error TS2693: 'I' only refers to a type, but is being used as a value here. @@ -32,7 +32,7 @@ tests/cases/conformance/expressions/valuesAndReferences/assignments.ts(31,1): er !!! error TS2539: Cannot assign to 'E' because it is not a variable. E.A = null; // OK per spec, Error per implementation (509581) ~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. function fn() { } fn = null; // Should be error diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt index 266c2180a68..cce3d89a761 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type '"no"' is not assignable to type 'number'. tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type '"no"' is not assignable to type 'number'. tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '0' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type '0' is not assignable to type 'string'. tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type '"no"' is not assignable to type 'number'. tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not assignable to type 'string'. @@ -29,10 +29,10 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not // disallowed assignments m1.readonlyProp = "name"; ~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. m1.readonlyAccessor = 12; ~~~~~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m1.thing = "no"; ~~~~~~~~ !!! error TS2322: Type '"no"' is not assignable to type 'number'. @@ -59,10 +59,10 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not // disallowed assignments m2.readonlyProp = "name"; ~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. m2.readonlyAccessor = 12; ~~~~~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m2.thing = 0; ~~~~~~~~ !!! error TS2322: Type '0' is not assignable to type 'string'. diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt index c2621a71b99..4d9ced85253 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '"no"' is not assignable to type 'number'. tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type '"no"' is not assignable to type 'number'. tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not assignable to type 'string'. @@ -26,10 +26,10 @@ tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not // disallowed assignments m1.readonlyProp = "name"; ~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyProp' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. m1.readonlyAccessor = 12; ~~~~~~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m1.thing = "no"; ~~~~~~~~ !!! error TS2322: Type '"no"' is not assignable to type 'number'. diff --git a/tests/baselines/reference/checkObjectDefineProperty.errors.txt b/tests/baselines/reference/checkObjectDefineProperty.errors.txt index b587955ef2f..373b219d96c 100644 --- a/tests/baselines/reference/checkObjectDefineProperty.errors.txt +++ b/tests/baselines/reference/checkObjectDefineProperty.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. +tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type '12' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. ==== tests/cases/conformance/jsdoc/validate.ts (4 errors) ==== @@ -20,16 +20,16 @@ tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to x.lastName = "should fail"; ~~~~~~~~ -!!! error TS2540: Cannot assign to 'lastName' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. x.houseNumber = 12; // should also fail ~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'houseNumber' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. x.zipStr = 12; // should fail ~~~~~~~~ !!! error TS2322: Type '12' is not assignable to type 'string'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'middleInit' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. ==== tests/cases/conformance/jsdoc/index.js (0 errors) ==== const x = {}; diff --git a/tests/baselines/reference/checkOtherObjectAssignProperty.errors.txt b/tests/baselines/reference/checkOtherObjectAssignProperty.errors.txt index 146550d6fb6..eb7f066c0b1 100644 --- a/tests/baselines/reference/checkOtherObjectAssignProperty.errors.txt +++ b/tests/baselines/reference/checkOtherObjectAssignProperty.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/jsdoc/importer.js(3,5): error TS2339: Property 'other' d tests/cases/conformance/jsdoc/importer.js(4,5): error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'. tests/cases/conformance/jsdoc/importer.js(11,5): error TS2339: Property 'other' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'. tests/cases/conformance/jsdoc/importer.js(12,5): error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'. -tests/cases/conformance/jsdoc/importer.js(13,5): error TS2540: Cannot assign to 'bad1' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/importer.js(14,5): error TS2540: Cannot assign to 'bad2' because it is a constant or a read-only property. -tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to 'bad3' because it is a constant or a read-only property. +tests/cases/conformance/jsdoc/importer.js(13,5): error TS2540: Cannot assign to 'bad1' because it is a read-only property. +tests/cases/conformance/jsdoc/importer.js(14,5): error TS2540: Cannot assign to 'bad2' because it is a read-only property. +tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to 'bad3' because it is a read-only property. ==== tests/cases/conformance/jsdoc/importer.js (7 errors) ==== @@ -30,13 +30,13 @@ tests/cases/conformance/jsdoc/importer.js(15,5): error TS2540: Cannot assign to !!! error TS2339: Property 'prop' does not exist on type 'typeof import("tests/cases/conformance/jsdoc/mod1")'. mod.bad1 = 0; ~~~~ -!!! error TS2540: Cannot assign to 'bad1' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'bad1' because it is a read-only property. mod.bad2 = 0; ~~~~ -!!! error TS2540: Cannot assign to 'bad2' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'bad2' because it is a read-only property. mod.bad3 = 0; ~~~~ -!!! error TS2540: Cannot assign to 'bad3' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'bad3' because it is a read-only property. ==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ==== const obj = { value: 42, writable: true }; diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 4018e0866d6..8bf05c043ce 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -31,9 +31,9 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2 Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type 'keyof T' is not assignable to type 'never'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a read-only property. tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray' only permits reading. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property. tests/cases/conformance/types/conditional/conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf' is not assignable to type 'T'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. @@ -231,13 +231,13 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS let id: number = part.subparts[0].id; part.id = part.id; // Error ~~ -!!! error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'id' because it is a read-only property. part.subparts[0] = part.subparts[0]; // Error ~~~~~~~~~~~~~~~~ !!! error TS2542: Index signature in type 'DeepReadonlyArray' only permits reading. part.subparts[0].id = part.subparts[0].id; // Error ~~ -!!! error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'id' because it is a read-only property. part.updatePart("hello"); // Error ~~~~~~~~~~ !!! error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. diff --git a/tests/baselines/reference/constDeclarations-access3.errors.txt b/tests/baselines/reference/constDeclarations-access3.errors.txt index dd55ef9166d..b6cada1c939 100644 --- a/tests/baselines/reference/constDeclarations-access3.errors.txt +++ b/tests/baselines/reference/constDeclarations-access3.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations-access3.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(16,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(21,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(24,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(16,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(19,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(20,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(21,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(22,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(24,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot assign to 'x' because it is a read-only property. ==== tests/cases/compiler/constDeclarations-access3.ts (18 errors) ==== @@ -26,61 +26,61 @@ tests/cases/compiler/constDeclarations-access3.ts(26,3): error TS2540: Cannot as // Errors M.x = 1; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x += 2; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x -= 3; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x *= 4; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x /= 5; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x %= 6; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x <<= 7; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x >>= 8; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x >>>= 9; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x &= 10; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x |= 11; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x ^= 12; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x--; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++M.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. --M.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++((M.x)); ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M["x"] = 0; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. // OK var a = M.x + 1; diff --git a/tests/baselines/reference/constDeclarations-access4.errors.txt b/tests/baselines/reference/constDeclarations-access4.errors.txt index 5bc4f1fadda..24ad11b2a3d 100644 --- a/tests/baselines/reference/constDeclarations-access4.errors.txt +++ b/tests/baselines/reference/constDeclarations-access4.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations-access4.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(16,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(19,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(20,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(21,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(22,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(24,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(16,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(19,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(20,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(21,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(22,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(24,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot assign to 'x' because it is a read-only property. ==== tests/cases/compiler/constDeclarations-access4.ts (18 errors) ==== @@ -26,61 +26,61 @@ tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2540: Cannot as // Errors M.x = 1; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x += 2; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x -= 3; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x *= 4; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x /= 5; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x %= 6; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x <<= 7; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x >>= 8; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x >>>= 9; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x &= 10; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x |= 11; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x ^= 12; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M.x--; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++M.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. --M.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++((M.x)); ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. M["x"] = 0; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. // OK var a = M.x + 1; diff --git a/tests/baselines/reference/constDeclarations-access5.errors.txt b/tests/baselines/reference/constDeclarations-access5.errors.txt index 61d579dccc5..739a8fca1fc 100644 --- a/tests/baselines/reference/constDeclarations-access5.errors.txt +++ b/tests/baselines/reference/constDeclarations-access5.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/constDeclarations_access_2.ts(4,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(5,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(6,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(7,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(8,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(9,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(10,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(11,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(12,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(13,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(14,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(15,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(17,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(18,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(19,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(20,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(22,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(4,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(5,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(6,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(7,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(8,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(9,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(10,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(11,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(12,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(13,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(14,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(15,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(17,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(18,3): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(19,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(20,5): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(22,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot assign to 'x' because it is a read-only property. ==== tests/cases/compiler/constDeclarations_access_2.ts (18 errors) ==== @@ -24,61 +24,61 @@ tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot a // Errors m.x = 1; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x += 2; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x -= 3; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x *= 4; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x /= 5; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x %= 6; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x <<= 7; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x >>= 8; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x >>>= 9; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x &= 10; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x |= 11; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x ^= 12; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m m.x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m.x--; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++m.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. --m.x; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. ++((m.x)); ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. m["x"] = 0; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. // OK var a = m.x + 1; diff --git a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt index 40731d3ad54..c80283f6536 100644 --- a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt +++ b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(13,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,12): error TS2476: A const enum member can only be accessed using a string literal. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type '"string"' is not assignable to type 'G'. -tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a read-only property. ==== tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts (4 errors) ==== @@ -30,5 +30,5 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS25 function foo(x: G) { } G.B = 3; ~ -!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'B' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt index 284e15c5193..a0fc95c6fb0 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a read-only property. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2542: Index signature in type 'typeof ENUM1' only permits reading. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'. @@ -14,15 +14,15 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp // expression var ResultIsNumber1 = --ENUM1["A"]; ~~~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. var ResultIsNumber2 = ENUM1.A--; ~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. // miss assignment operator --ENUM1["A"]; ~~~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. ENUM1[A]--; ~~~~~~~~ diff --git a/tests/baselines/reference/enumMergeWithExpando.errors.txt b/tests/baselines/reference/enumMergeWithExpando.errors.txt index 7911206650c..586a25c69bf 100644 --- a/tests/baselines/reference/enumMergeWithExpando.errors.txt +++ b/tests/baselines/reference/enumMergeWithExpando.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/salsa/enums.js(2,10): error TS2540: Cannot assign to 'DESC' because it is a constant or a read-only property. -tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'ASC' because it is a constant or a read-only property. +tests/cases/conformance/salsa/enums.js(2,10): error TS2540: Cannot assign to 'DESC' because it is a read-only property. +tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'ASC' because it is a read-only property. ==== tests/cases/conformance/salsa/lovefield-ts.d.ts (0 errors) ==== @@ -12,8 +12,8 @@ tests/cases/conformance/salsa/enums.js(3,10): error TS2540: Cannot assign to 'AS lf.Order = {} lf.Order.DESC = 0; ~~~~ -!!! error TS2540: Cannot assign to 'DESC' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'DESC' because it is a read-only property. lf.Order.ASC = 1; ~~~ -!!! error TS2540: Cannot assign to 'ASC' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'ASC' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt index d6a2be707e0..832ce01f751 100644 --- a/tests/baselines/reference/externalModuleImmutableBindings.errors.txt +++ b/tests/baselines/reference/externalModuleImmutableBindings.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/f2.ts(6,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(7,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/f2.ts(6,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(7,7): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/compiler/f2.ts(8,7): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. -tests/cases/compiler/f2.ts(11,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(12,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(16,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(17,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/f2.ts(11,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(12,7): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(16,8): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(17,8): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/compiler/f2.ts(18,8): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. -tests/cases/compiler/f2.ts(21,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(22,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(26,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(27,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(28,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(29,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/f2.ts(21,8): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(22,8): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(26,12): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(27,12): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(28,12): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(29,12): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/compiler/f2.ts(30,12): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. tests/cases/compiler/f2.ts(31,12): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. -tests/cases/compiler/f2.ts(35,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(36,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(37,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/compiler/f2.ts(38,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/compiler/f2.ts(35,13): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(36,13): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(37,13): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/compiler/f2.ts(38,13): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/compiler/f2.ts(39,13): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. @@ -33,10 +33,10 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist stuff.x = 0; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. stuff['x'] = 1; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. stuff.blah = 2; ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. @@ -44,19 +44,19 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist stuff.x++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. stuff['x']++; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. stuff['blah']++; stuff[n]++; (stuff.x) = 0; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. (stuff['x']) = 1; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. (stuff.blah) = 2; ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. @@ -64,25 +64,25 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist (stuff.x)++; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. (stuff['x'])++; ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. (stuff['blah'])++; (stuff[n])++; for (stuff.x in []) {} ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for (stuff.x of []) {} ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for (stuff['x'] in []) {} ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for (stuff['x'] of []) {} ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for (stuff.blah in []) {} ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. @@ -94,16 +94,16 @@ tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist for ((stuff.x) in []) {} ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for ((stuff.x) of []) {} ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for ((stuff['x']) in []) {} ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for ((stuff['x']) of []) {} ~~~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. for ((stuff.blah) in []) {} ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof import("tests/cases/compiler/f1")'. diff --git a/tests/baselines/reference/importsImplicitlyReadonly.errors.txt b/tests/baselines/reference/importsImplicitlyReadonly.errors.txt index aad8480a77a..f760e08f36a 100644 --- a/tests/baselines/reference/importsImplicitlyReadonly.errors.txt +++ b/tests/baselines/reference/importsImplicitlyReadonly.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/externalModules/b.ts(6,1): error TS2539: Cannot assign to 'x' because it is not a variable. tests/cases/conformance/externalModules/b.ts(7,1): error TS2539: Cannot assign to 'y' because it is not a variable. -tests/cases/conformance/externalModules/b.ts(8,4): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. -tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign to 'y' because it is a constant or a read-only property. +tests/cases/conformance/externalModules/b.ts(8,4): error TS2540: Cannot assign to 'x' because it is a read-only property. +tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign to 'y' because it is a read-only property. ==== tests/cases/conformance/externalModules/b.ts (4 errors) ==== @@ -18,10 +18,10 @@ tests/cases/conformance/externalModules/b.ts(9,4): error TS2540: Cannot assign t !!! error TS2539: Cannot assign to 'y' because it is not a variable. a1.x = 1; // Error ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. a1.y = 1; // Error ~ -!!! error TS2540: Cannot assign to 'y' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'y' because it is a read-only property. a2.x = 1; a2.y = 1; a3.x = 1; diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt index 8fdbc343562..eb1d0955a92 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithEnumType.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,7): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'B' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'B' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'B' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,7): error TS2540: Cannot assign to 'B' because it is a read-only property. ==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts (4 errors) ==== @@ -12,16 +12,16 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp // expression var ResultIsNumber1 = ++ENUM1["B"]; ~~~ -!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'B' because it is a read-only property. var ResultIsNumber2 = ENUM1.B++; ~ -!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'B' because it is a read-only property. // miss assignment operator ++ENUM1["B"]; ~~~ -!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'B' because it is a read-only property. ENUM1.B++; ~ -!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property. \ No newline at end of file +!!! error TS2540: Cannot assign to 'B' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/intersectionTypeReadonly.errors.txt b/tests/baselines/reference/intersectionTypeReadonly.errors.txt index 88ca9cb3b0c..6aed59d9d91 100644 --- a/tests/baselines/reference/intersectionTypeReadonly.errors.txt +++ b/tests/baselines/reference/intersectionTypeReadonly.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): error TS2540: Cannot assign to 'value' because it is a read-only property. ==== tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts (5 errors) ==== @@ -24,21 +24,21 @@ tests/cases/conformance/types/intersection/intersectionTypeReadonly.ts(25,15): e let base: Base; base.value = 12 // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let identical: Base & Identical; identical.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let mutable: Base & Mutable; mutable.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let differentType: Base & DifferentType; differentType.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let differentName: Base & DifferentName; differentName.value = 12; // error, property 'value' doesn't exist ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt index b0a30f2dff3..223835f2027 100644 --- a/tests/baselines/reference/invalidUndefinedAssignments.errors.txt +++ b/tests/baselines/reference/invalidUndefinedAssignments.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(4,1): error TS2539: Cannot assign to 'E' because it is not a variable. -tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(5,3): error TS2540: Cannot assign to 'A' because it is a read-only property. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(9,1): error TS2539: Cannot assign to 'C' because it is not a variable. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(14,1): error TS2693: 'I' only refers to a type, but is being used as a value here. tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable. @@ -15,7 +15,7 @@ tests/cases/conformance/types/primitives/undefined/invalidUndefinedAssignments.t !!! error TS2539: Cannot assign to 'E' because it is not a variable. E.A = x; ~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. class C { foo: string } var f: C; diff --git a/tests/baselines/reference/mappedTypes6.errors.txt b/tests/baselines/reference/mappedTypes6.errors.txt index 843a59eecb5..f053ae313c5 100644 --- a/tests/baselines/reference/mappedTypes6.errors.txt +++ b/tests/baselines/reference/mappedTypes6.errors.txt @@ -19,9 +19,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(105,1): error TS2322: Type Property 'c' is missing in type '{ a: number; b: number; }'. tests/cases/conformance/types/mapped/mappedTypes6.ts(106,1): error TS2322: Type '{ a: number; b: number; c: number; }' is not assignable to type 'Required'. Property 'd' is missing in type '{ a: number; b: number; c: number; }'. -tests/cases/conformance/types/mapped/mappedTypes6.ts(116,4): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. -tests/cases/conformance/types/mapped/mappedTypes6.ts(119,4): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +tests/cases/conformance/types/mapped/mappedTypes6.ts(116,4): error TS2540: Cannot assign to 'b' because it is a read-only property. +tests/cases/conformance/types/mapped/mappedTypes6.ts(119,4): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Cannot assign to 'b' because it is a read-only property. ==== tests/cases/conformance/types/mapped/mappedTypes6.ts (19 errors) ==== @@ -179,15 +179,15 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno x3.a = 1; x3.b = 1; // Error ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. declare let x4: Readonly; x4.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. x4.b = 1; // Error ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. declare let x5: Readwrite; x5.a = 1; diff --git a/tests/baselines/reference/objectFreeze.errors.txt b/tests/baselines/reference/objectFreeze.errors.txt index 48f41143d61..f89ef42f4c7 100644 --- a/tests/baselines/reference/objectFreeze.errors.txt +++ b/tests/baselines/reference/objectFreeze.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/objectFreeze.ts(9,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'ReadonlyArray' only permits reading. -tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a read-only property. ==== tests/cases/compiler/objectFreeze.ts (3 errors) ==== @@ -21,5 +21,5 @@ tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' b const o = Object.freeze({ a: 1, b: "string" }); o.b = o.a.toString(); ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt index e878d0fd54f..6ce02e5e232 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt @@ -1,5 +1,5 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'. -maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property. ==== maxDepthExceeded/tsconfig.json (0 errors) ==== @@ -36,7 +36,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i !!! error TS2322: Type '"10"' is not assignable to type 'number'. m1.rel = 42; // Error: Should be boolean ~~~ -!!! error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'rel' because it is a read-only property. m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any". diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt index e878d0fd54f..6ce02e5e232 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt @@ -1,5 +1,5 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'. -maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property. ==== maxDepthExceeded/tsconfig.json (0 errors) ==== @@ -36,7 +36,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i !!! error TS2322: Type '"10"' is not assignable to type 'number'. m1.rel = 42; // Error: Should be boolean ~~~ -!!! error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'rel' because it is a read-only property. m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any". diff --git a/tests/baselines/reference/readonlyAssignmentInSubclassOfClassExpression.errors.txt b/tests/baselines/reference/readonlyAssignmentInSubclassOfClassExpression.errors.txt index 760cee54025..ceae2b62d6c 100644 --- a/tests/baselines/reference/readonlyAssignmentInSubclassOfClassExpression.errors.txt +++ b/tests/baselines/reference/readonlyAssignmentInSubclassOfClassExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): error TS2540: Cannot assign to 'attrib' because it is a constant or a read-only property. +tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): error TS2540: Cannot assign to 'attrib' because it is a read-only property. ==== tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/readonlyAssignmentInSubclassOfClassExpression.ts(4,14): err super() this.attrib = 2 ~~~~~~ -!!! error TS2540: Cannot assign to 'attrib' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'attrib' because it is a read-only property. } } \ No newline at end of file diff --git a/tests/baselines/reference/readonlyConstructorAssignment.errors.txt b/tests/baselines/reference/readonlyConstructorAssignment.errors.txt index 31b4ad969cb..ecd22168d72 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.errors.txt +++ b/tests/baselines/reference/readonlyConstructorAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(13,14): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(13,14): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyConstructorAssignment.ts(33,7): error TS2415: Class 'E' incorrectly extends base class 'D'. Property 'x' is private in type 'D' but not in type 'E'. @@ -18,7 +18,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/re // Fails, x is readonly this.x = 1; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. } } diff --git a/tests/baselines/reference/readonlyInConstructorParameters.errors.txt b/tests/baselines/reference/readonlyInConstructorParameters.errors.txt index 15d0d0be8eb..4737812728a 100644 --- a/tests/baselines/reference/readonlyInConstructorParameters.errors.txt +++ b/tests/baselines/reference/readonlyInConstructorParameters.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(4,10): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(4,10): error TS2540: Cannot assign to 'x' because it is a read-only property. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(7,26): error TS1029: 'public' modifier must precede 'readonly' modifier. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts(13,10): error TS2341: Property 'x' is private and only accessible within class 'F'. @@ -9,7 +9,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/re } new C(1).x = 2; ~ -!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'x' because it is a read-only property. class E { constructor(readonly public x: number) {} diff --git a/tests/baselines/reference/readonlyMembers.errors.txt b/tests/baselines/reference/readonlyMembers.errors.txt index 9baf37f27e7..bea7932ed4c 100644 --- a/tests/baselines/reference/readonlyMembers.errors.txt +++ b/tests/baselines/reference/readonlyMembers.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/readonlyMembers.ts(6,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(7,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(16,14): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(18,18): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(19,18): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(20,18): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(24,14): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(25,14): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(26,14): error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(35,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(39,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(48,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. -tests/cases/compiler/readonlyMembers.ts(55,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +tests/cases/compiler/readonlyMembers.ts(6,3): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(7,3): error TS2540: Cannot assign to 'b' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(16,14): error TS2540: Cannot assign to 'c' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(18,18): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(19,18): error TS2540: Cannot assign to 'b' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(20,18): error TS2540: Cannot assign to 'c' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(24,14): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(25,14): error TS2540: Cannot assign to 'b' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(26,14): error TS2540: Cannot assign to 'c' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(35,3): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(39,3): error TS2540: Cannot assign to 'a' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(48,3): error TS2540: Cannot assign to 'A' because it is a read-only property. +tests/cases/compiler/readonlyMembers.ts(55,3): error TS2540: Cannot assign to 'a' because it is a read-only property. tests/cases/compiler/readonlyMembers.ts(61,1): error TS2542: Index signature in type '{ readonly [x: string]: string; }' only permits reading. tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in type '{ [x: string]: string; readonly [x: number]: string; }' only permits reading. @@ -23,10 +23,10 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in var x: X = { a: 0 }; x.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. x.b = 1; // Error ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. class C { readonly a: number; @@ -37,29 +37,29 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in this.b = 1; // Ok this.c = 1; // Error ~ -!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'c' because it is a read-only property. const f = () => { this.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. this.b = 1; // Error ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. this.c = 1; // Error ~ -!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'c' because it is a read-only property. } } foo() { this.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. this.b = 1; // Error ~ -!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'b' because it is a read-only property. this.c = 1; // Error ~ -!!! error TS2540: Cannot assign to 'c' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'c' because it is a read-only property. } } @@ -70,13 +70,13 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in }; o.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. o.b = 1; var p: { readonly a: number, b: number } = { a: 1, b: 1 }; p.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. p.b = 1; var q: { a: number, b: number } = p; q.a = 1; @@ -87,7 +87,7 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in } E.A = 1; // Error ~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. namespace N { export const a = 1; @@ -96,7 +96,7 @@ tests/cases/compiler/readonlyMembers.ts(64,1): error TS2542: Index signature in } N.a = 1; // Error ~ -!!! error TS2540: Cannot assign to 'a' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'a' because it is a read-only property. N.b = 1; N.c = 1; diff --git a/tests/baselines/reference/unionTypeReadonly.errors.txt b/tests/baselines/reference/unionTypeReadonly.errors.txt index 8248431a932..0d11c63d17f 100644 --- a/tests/baselines/reference/unionTypeReadonly.errors.txt +++ b/tests/baselines/reference/unionTypeReadonly.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/union/unionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/union/unionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/union/unionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. -tests/cases/conformance/types/union/unionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +tests/cases/conformance/types/union/unionTypeReadonly.ts(17,6): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/union/unionTypeReadonly.ts(19,11): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/union/unionTypeReadonly.ts(21,9): error TS2540: Cannot assign to 'value' because it is a read-only property. +tests/cases/conformance/types/union/unionTypeReadonly.ts(23,15): error TS2540: Cannot assign to 'value' because it is a read-only property. tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: Property 'value' does not exist on type 'Base | DifferentName'. Property 'value' does not exist on type 'DifferentName'. @@ -25,19 +25,19 @@ tests/cases/conformance/types/union/unionTypeReadonly.ts(25,15): error TS2339: P let base: Base; base.value = 12 // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let identical: Base | Identical; identical.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let mutable: Base | Mutable; mutable.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let differentType: Base | DifferentType; differentType.value = 12; // error, lhs can't be a readonly property ~~~~~ -!!! error TS2540: Cannot assign to 'value' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'value' because it is a read-only property. let differentName: Base | DifferentName; differentName.value = 12; // error, property 'value' doesn't exist ~~~~~ diff --git a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt index e95a184d15a..fb4463bc2d9 100644 --- a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt +++ b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(11,3): error TS2339: Property 'bar' does not exist on type 'Missing'. Property 'bar' does not exist on type '{ [s: string]: string; }'. -tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. +tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a read-only property. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(24,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(25,1): error TS2322: Type '"not ok"' is not assignable to type 'number'. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. @@ -25,7 +25,7 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error declare var ro: RO ro.foo = 'not allowed' ~~~ -!!! error TS2540: Cannot assign to 'foo' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'foo' because it is a read-only property. type Num = { '0': string } | { [n: number]: number } declare var num: Num num[0] = 1 diff --git a/tests/baselines/reference/validNullAssignments.errors.txt b/tests/baselines/reference/validNullAssignments.errors.txt index ae3b0695c9d..e3dd21599b5 100644 --- a/tests/baselines/reference/validNullAssignments.errors.txt +++ b/tests/baselines/reference/validNullAssignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +tests/cases/conformance/types/primitives/null/validNullAssignments.ts(10,3): error TS2540: Cannot assign to 'A' because it is a read-only property. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(15,1): error TS2539: Cannot assign to 'C' because it is not a variable. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(20,1): error TS2693: 'I' only refers to a type, but is being used as a value here. tests/cases/conformance/types/primitives/null/validNullAssignments.ts(23,1): error TS2539: Cannot assign to 'M' because it is not a variable. @@ -17,7 +17,7 @@ tests/cases/conformance/types/primitives/null/validNullAssignments.ts(30,1): err enum E { A } E.A = null; // error ~ -!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'A' because it is a read-only property. class C { foo: string } var f: C; From 3f4c00c8a6ea4d15dbf4addbcc665875b4fd43c7 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 7 Nov 2018 10:20:11 +0200 Subject: [PATCH 019/294] resolve conflicts --- tests/baselines/reference/bigintWithLib.errors.txt | 8 ++++---- .../reference/decrementOperatorWithEnumType.errors.txt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 18267e6ffdf..03d1f3f755f 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function c tests/cases/compiler/bigintWithLib.ts(16,33): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. Type 'number[]' is not assignable to type 'SharedArrayBuffer'. Property 'byteLength' is missing in type 'number[]'. -tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a constant or a read-only property. +tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property. tests/cases/compiler/bigintWithLib.ts(28,35): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. Type 'number[]' is not assignable to type 'SharedArrayBuffer'. -tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a constant or a read-only property. +tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property. tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'. tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'. @@ -39,7 +39,7 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 let len: number = bigIntArray.length; bigIntArray.length = 10; // should error ~~~~~~ -!!! error TS2540: Cannot assign to 'length' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'length' because it is a read-only property. let arrayBufferLike: ArrayBufferView = bigIntArray; // Test BigUint64Array @@ -56,7 +56,7 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 len = bigIntArray.length; bigIntArray.length = 10; // should error ~~~~~~ -!!! error TS2540: Cannot assign to 'length' because it is a constant or a read-only property. +!!! error TS2540: Cannot assign to 'length' because it is a read-only property. arrayBufferLike = bigIntArray; // Test added DataView methods diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt index 545f128a53e..51d8f13d5ed 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a read-only property. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a read-only property. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2542: Index signature in type 'typeof ENUM1' only permits reading. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'. From f7ad54b432c2fc0fc437f3e25be03c34a2040e4f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:20:54 -0800 Subject: [PATCH 020/294] Only complain about BigInt literals in pre-ESNext targets. --- src/compiler/checker.ts | 5 +---- src/compiler/commandLineParser.ts | 6 ------ src/compiler/diagnosticMessages.json | 10 +--------- src/compiler/types.ts | 1 - 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f06a284a729..1ae0817358a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30528,13 +30528,10 @@ namespace ts { isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent); if (!literalType) { if (languageVersion < ScriptTarget.ESNext) { - if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targetting_lower_than_ESNext)) { + if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) { return true; } } - if (!compilerOptions.experimentalBigInt) { - return grammarErrorOnNode(node, Diagnostics.Experimental_support_for_BigInt_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalBigInt_option_to_remove_this_warning); - } } return false; } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e3b6fe69d21..972336967dc 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -584,12 +584,6 @@ namespace ts { category: Diagnostics.Experimental_Options, description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators }, - { - name: "experimentalBigInt", - type: "boolean", - category: Diagnostics.Experimental_Options, - description: Diagnostics.Enables_experimental_support_for_ESNext_BigInt_literals - }, // Advanced { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3ba74f03073..b8509cae1e5 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1011,10 +1011,6 @@ "category": "Message", "code": 1350 }, - "Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning.": { - "category": "Error", - "code": 1351 - }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -2505,7 +2501,7 @@ "category": "Error", "code": 2736 }, - "BigInt literals are not available when targetting lower than ESNext.": { + "BigInt literals are not available when targeting lower than ESNext.": { "category": "Error", "code": 2737 }, @@ -3921,10 +3917,6 @@ "category": "Error", "code": 6370 }, - "Enables experimental support for ESNext BigInt literals.": { - "category": "Message", - "code": 6371 - }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 45e63475924..65a04d43949 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4495,7 +4495,6 @@ namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; /*@internal*/help?: boolean; From 15f2f047f8e1d28d004fcc5c0772dff94c45582d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:21:06 -0800 Subject: [PATCH 021/294] Updated test case. --- tests/cases/compiler/warnExperimentalBigIntLiteral.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts index c59bff0696e..6b09bf51241 100644 --- a/tests/cases/compiler/warnExperimentalBigIntLiteral.ts +++ b/tests/cases/compiler/warnExperimentalBigIntLiteral.ts @@ -1,7 +1,8 @@ -// @target: esnext +// @target: es3 const normalNumber = 123; // should not error let bigintType: bigint; // should not error let bigintLiteralType: 123n; // should not error when used as type let bigintNegativeLiteralType: -123n; // should not error when used as type -const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error \ No newline at end of file +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + From 17b77dfdced91a910bdcb2a4dc68e02345528699 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 16:21:16 -0800 Subject: [PATCH 022/294] Accepted baselines. --- .../warnExperimentalBigIntLiteral.errors.txt | 18 ++++++++++-------- .../reference/warnExperimentalBigIntLiteral.js | 14 ++++++++------ .../warnExperimentalBigIntLiteral.symbols | 1 + .../warnExperimentalBigIntLiteral.types | 1 + 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt b/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt index 3e8e50d148c..5b442c746b9 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,22): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,29): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,39): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. -tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext. +tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext. ==== tests/cases/compiler/warnExperimentalBigIntLiteral.ts (4 errors) ==== @@ -11,10 +11,12 @@ tests/cases/compiler/warnExperimentalBigIntLiteral.ts(5,48): error TS1351: Exper let bigintNegativeLiteralType: -123n; // should not error when used as type const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error ~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. ~~~~~ -!!! error TS1351: Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning. \ No newline at end of file +!!! error TS2737: BigInt literals are not available when targeting lower than ESNext. + + \ No newline at end of file diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.js b/tests/baselines/reference/warnExperimentalBigIntLiteral.js index 2a1ee53b2c0..e07407bc1c2 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.js +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.js @@ -3,11 +3,13 @@ const normalNumber = 123; // should not error let bigintType: bigint; // should not error let bigintLiteralType: 123n; // should not error when used as type let bigintNegativeLiteralType: -123n; // should not error when used as type -const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error +const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error + + //// [warnExperimentalBigIntLiteral.js] -const normalNumber = 123; // should not error -let bigintType; // should not error -let bigintLiteralType; // should not error when used as type -let bigintNegativeLiteralType; // should not error when used as type -const bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error +var normalNumber = 123; // should not error +var bigintType; // should not error +var bigintLiteralType; // should not error when used as type +var bigintNegativeLiteralType; // should not error when used as type +var bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols b/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols index 1ea1c380601..94cc867b42e 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.symbols @@ -14,3 +14,4 @@ let bigintNegativeLiteralType: -123n; // should not error when used as type const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error >bigintNumber : Symbol(bigintNumber, Decl(warnExperimentalBigIntLiteral.ts, 4, 5)) + diff --git a/tests/baselines/reference/warnExperimentalBigIntLiteral.types b/tests/baselines/reference/warnExperimentalBigIntLiteral.types index a0ba0a9564b..607c2aa9115 100644 --- a/tests/baselines/reference/warnExperimentalBigIntLiteral.types +++ b/tests/baselines/reference/warnExperimentalBigIntLiteral.types @@ -24,3 +24,4 @@ const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should err >0o444n : 292n >0x7fn : 127n + From 146afddae1121e26166968ec6e6208a9cc212844 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Nov 2018 17:09:16 -0800 Subject: [PATCH 023/294] Accepted baselines. --- tests/baselines/reference/api/tsserverlibrary.d.ts | 1 - tests/baselines/reference/api/typescript.d.ts | 1 - .../tsConfig/Default initialized TSConfig/tsconfig.json | 1 - .../Initialized TSConfig with advanced options/tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../Initialized TSConfig with files options/tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - .../tsconfig.json | 1 - 11 files changed, 11 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c024d926207..ac36533a094 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2450,7 +2450,6 @@ declare namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; importHelpers?: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 335283ce43f..83a5cab6a59 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2450,7 +2450,6 @@ declare namespace ts { downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; - experimentalBigInt?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; importHelpers?: boolean; diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 7d444ecc45f..e4e3d7b8ec4 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 43836a779ad..1919671c489 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -56,7 +56,6 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ /* Advanced Options */ "noErrorTruncation": true, /* Do not truncate error messages. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 73e0564f2ad..3b49dee6e3d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 51fd4e44cf9..d91e167877d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index dd8f183c32e..e6107b29b4c 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -56,7 +56,6 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ }, "files": [ "file0.st", diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index de16ddfba0c..7c18b695c7b 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 7d444ecc45f..e4e3d7b8ec4 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 587d9941a70..eedcc357043 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 75621cafebc..6fc7833730f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -56,6 +56,5 @@ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - // "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */ } } \ No newline at end of file From eb21eb8e11d32b81b43f810a6593025f0477d486 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 12 Nov 2018 13:52:47 -0800 Subject: [PATCH 024/294] Ensure all default type params are mapped to some default even in circular scenarios (#28423) * Ensure all default type params are mapped to some default even in circular scenarios * Add js example, fix typo --- src/compiler/checker.ts | 6 +- .../reference/subclassThisTypeAssignable.js | 43 ++++++++ .../subclassThisTypeAssignable.symbols | 98 +++++++++++++++++++ .../subclassThisTypeAssignable.types | 56 +++++++++++ .../compiler/subclassThisTypeAssignable.ts | 31 ++++++ 5 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/subclassThisTypeAssignable.js create mode 100644 tests/baselines/reference/subclassThisTypeAssignable.symbols create mode 100644 tests/baselines/reference/subclassThisTypeAssignable.types create mode 100644 tests/cases/compiler/subclassThisTypeAssignable.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5af3c9e9c51..26507b31ea1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7663,8 +7663,10 @@ namespace ts { // Map an unsatisfied type parameter with a default type. // If a type parameter does not have a default type, or if the default type // is a forward reference, the empty object type is used. + const baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny); + const circularityMapper = createTypeMapper(typeParameters!, map(typeParameters!, () => baseDefaultType)); for (let i = numTypeArguments; i < numTypeParameters; i++) { - result[i] = getConstraintFromTypeParameter(typeParameters![i]) || getDefaultTypeArgumentType(isJavaScriptImplicitAny); + result[i] = instantiateType(getConstraintFromTypeParameter(typeParameters![i]) || baseDefaultType, circularityMapper); } for (let i = numTypeArguments; i < numTypeParameters; i++) { const mapper = createTypeMapper(typeParameters!, result); @@ -7672,7 +7674,7 @@ namespace ts { if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) { defaultType = anyType; } - result[i] = defaultType ? instantiateType(defaultType, mapper) : getDefaultTypeArgumentType(isJavaScriptImplicitAny); + result[i] = defaultType ? instantiateType(defaultType, mapper) : baseDefaultType; } result.length = typeParameters!.length; return result; diff --git a/tests/baselines/reference/subclassThisTypeAssignable.js b/tests/baselines/reference/subclassThisTypeAssignable.js new file mode 100644 index 00000000000..b82e4462a05 --- /dev/null +++ b/tests/baselines/reference/subclassThisTypeAssignable.js @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/subclassThisTypeAssignable.ts] //// + +//// [tile1.ts] +interface Lifecycle { + oninit?(vnode: Vnode): number; + [_: number]: any; +} + +interface Vnode = Lifecycle> { + tag: Component; +} + +interface Component { + view(this: State, vnode: Vnode): number; +} + +interface ClassComponent extends Lifecycle> { + oninit?(vnode: Vnode): number; + view(vnode: Vnode): number; +} + +interface MyAttrs { id: number } +class C implements ClassComponent { + view(v: Vnode) { return 0; } +} + +const test8: ClassComponent = new C(); +//// [file1.js] +/** @type {ClassComponent} */ +const test9 = new C(); + + +//// [tile1.js] +var C = /** @class */ (function () { + function C() { + } + C.prototype.view = function (v) { return 0; }; + return C; +}()); +var test8 = new C(); +//// [file1.js] +/** @type {ClassComponent} */ +var test9 = new C(); diff --git a/tests/baselines/reference/subclassThisTypeAssignable.symbols b/tests/baselines/reference/subclassThisTypeAssignable.symbols new file mode 100644 index 00000000000..8cfc25b28a6 --- /dev/null +++ b/tests/baselines/reference/subclassThisTypeAssignable.symbols @@ -0,0 +1,98 @@ +=== tests/cases/compiler/tile1.ts === +interface Lifecycle { +>Lifecycle : Symbol(Lifecycle, Decl(tile1.ts, 0, 0)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 0, 20)) +>State : Symbol(State, Decl(tile1.ts, 0, 26)) + + oninit?(vnode: Vnode): number; +>oninit : Symbol(Lifecycle.oninit, Decl(tile1.ts, 0, 35)) +>vnode : Symbol(vnode, Decl(tile1.ts, 1, 9)) +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 0, 20)) +>State : Symbol(State, Decl(tile1.ts, 0, 26)) + + [_: number]: any; +>_ : Symbol(_, Decl(tile1.ts, 2, 2)) +} + +interface Vnode = Lifecycle> { +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 5, 16)) +>State : Symbol(State, Decl(tile1.ts, 5, 22)) +>Lifecycle : Symbol(Lifecycle, Decl(tile1.ts, 0, 0)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 5, 16)) +>State : Symbol(State, Decl(tile1.ts, 5, 22)) +>Lifecycle : Symbol(Lifecycle, Decl(tile1.ts, 0, 0)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 5, 16)) +>State : Symbol(State, Decl(tile1.ts, 5, 22)) + + tag: Component; +>tag : Symbol(Vnode.tag, Decl(tile1.ts, 5, 89)) +>Component : Symbol(Component, Decl(tile1.ts, 7, 1)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 5, 16)) +>State : Symbol(State, Decl(tile1.ts, 5, 22)) +} + +interface Component { +>Component : Symbol(Component, Decl(tile1.ts, 7, 1)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 9, 20)) +>State : Symbol(State, Decl(tile1.ts, 9, 26)) + + view(this: State, vnode: Vnode): number; +>view : Symbol(Component.view, Decl(tile1.ts, 9, 35)) +>this : Symbol(this, Decl(tile1.ts, 10, 6)) +>State : Symbol(State, Decl(tile1.ts, 9, 26)) +>vnode : Symbol(vnode, Decl(tile1.ts, 10, 18)) +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>Attrs : Symbol(Attrs, Decl(tile1.ts, 9, 20)) +>State : Symbol(State, Decl(tile1.ts, 9, 26)) +} + +interface ClassComponent extends Lifecycle> { +>ClassComponent : Symbol(ClassComponent, Decl(tile1.ts, 11, 1)) +>A : Symbol(A, Decl(tile1.ts, 13, 25)) +>Lifecycle : Symbol(Lifecycle, Decl(tile1.ts, 0, 0)) +>A : Symbol(A, Decl(tile1.ts, 13, 25)) +>ClassComponent : Symbol(ClassComponent, Decl(tile1.ts, 11, 1)) +>A : Symbol(A, Decl(tile1.ts, 13, 25)) + + oninit?(vnode: Vnode): number; +>oninit : Symbol(ClassComponent.oninit, Decl(tile1.ts, 13, 69)) +>vnode : Symbol(vnode, Decl(tile1.ts, 14, 9)) +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>A : Symbol(A, Decl(tile1.ts, 13, 25)) + + view(vnode: Vnode): number; +>view : Symbol(ClassComponent.view, Decl(tile1.ts, 14, 40)) +>vnode : Symbol(vnode, Decl(tile1.ts, 15, 6)) +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>A : Symbol(A, Decl(tile1.ts, 13, 25)) +} + +interface MyAttrs { id: number } +>MyAttrs : Symbol(MyAttrs, Decl(tile1.ts, 16, 1)) +>id : Symbol(MyAttrs.id, Decl(tile1.ts, 18, 19)) + +class C implements ClassComponent { +>C : Symbol(C, Decl(tile1.ts, 18, 32)) +>ClassComponent : Symbol(ClassComponent, Decl(tile1.ts, 11, 1)) +>MyAttrs : Symbol(MyAttrs, Decl(tile1.ts, 16, 1)) + + view(v: Vnode) { return 0; } +>view : Symbol(C.view, Decl(tile1.ts, 19, 44)) +>v : Symbol(v, Decl(tile1.ts, 20, 6)) +>Vnode : Symbol(Vnode, Decl(tile1.ts, 3, 1)) +>MyAttrs : Symbol(MyAttrs, Decl(tile1.ts, 16, 1)) +} + +const test8: ClassComponent = new C(); +>test8 : Symbol(test8, Decl(tile1.ts, 23, 5)) +>ClassComponent : Symbol(ClassComponent, Decl(tile1.ts, 11, 1)) +>C : Symbol(C, Decl(tile1.ts, 18, 32)) + +=== tests/cases/compiler/file1.js === +/** @type {ClassComponent} */ +const test9 = new C(); +>test9 : Symbol(test9, Decl(file1.js, 1, 5)) +>C : Symbol(C, Decl(tile1.ts, 18, 32)) + diff --git a/tests/baselines/reference/subclassThisTypeAssignable.types b/tests/baselines/reference/subclassThisTypeAssignable.types new file mode 100644 index 00000000000..711b0056277 --- /dev/null +++ b/tests/baselines/reference/subclassThisTypeAssignable.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/tile1.ts === +interface Lifecycle { + oninit?(vnode: Vnode): number; +>oninit : (vnode: Vnode) => number +>vnode : Vnode + + [_: number]: any; +>_ : number +} + +interface Vnode = Lifecycle> { + tag: Component; +>tag : Component +} + +interface Component { + view(this: State, vnode: Vnode): number; +>view : (this: State, vnode: Vnode) => number +>this : State +>vnode : Vnode +} + +interface ClassComponent extends Lifecycle> { + oninit?(vnode: Vnode): number; +>oninit : (vnode: Vnode) => number +>vnode : Vnode + + view(vnode: Vnode): number; +>view : (vnode: Vnode) => number +>vnode : Vnode +} + +interface MyAttrs { id: number } +>id : number + +class C implements ClassComponent { +>C : C + + view(v: Vnode) { return 0; } +>view : (v: Vnode>>) => number +>v : Vnode>> +>0 : 0 +} + +const test8: ClassComponent = new C(); +>test8 : ClassComponent +>new C() : C +>C : typeof C + +=== tests/cases/compiler/file1.js === +/** @type {ClassComponent} */ +const test9 = new C(); +>test9 : ClassComponent +>new C() : C +>C : typeof C + diff --git a/tests/cases/compiler/subclassThisTypeAssignable.ts b/tests/cases/compiler/subclassThisTypeAssignable.ts new file mode 100644 index 00000000000..a582fd0f4c3 --- /dev/null +++ b/tests/cases/compiler/subclassThisTypeAssignable.ts @@ -0,0 +1,31 @@ +// @allowJs: true +// @checkJs: true +// @outDir: ./out +// @filename: tile1.ts +interface Lifecycle { + oninit?(vnode: Vnode): number; + [_: number]: any; +} + +interface Vnode = Lifecycle> { + tag: Component; +} + +interface Component { + view(this: State, vnode: Vnode): number; +} + +interface ClassComponent extends Lifecycle> { + oninit?(vnode: Vnode): number; + view(vnode: Vnode): number; +} + +interface MyAttrs { id: number } +class C implements ClassComponent { + view(v: Vnode) { return 0; } +} + +const test8: ClassComponent = new C(); +// @filename: file1.js +/** @type {ClassComponent} */ +const test9 = new C(); From 11eee2b6eeb9fd048a85b2194396843a16a597a4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 12 Nov 2018 14:31:15 -0800 Subject: [PATCH 025/294] Slightly improve missing property errors (#28298) * Slightly improve missing property errors * Add missing quote * Fix jsx case * Add related span * Fix crash (why can declarations be undefined) * Only skip top elaboration when no variant message is provided --- src/compiler/checker.ts | 63 +++++- src/compiler/core.ts | 6 +- src/compiler/diagnosticMessages.json | 12 ++ src/compiler/utilities.ts | 6 +- src/services/codefixes/fixAddMissingMember.ts | 3 + ...umentExpressionContextualTyping.errors.txt | 10 +- .../arityAndOrderCompatibility01.errors.txt | 54 ++--- .../reference/arrayAssignmentTest1.errors.txt | 122 ++++------- .../reference/arrayAssignmentTest2.errors.txt | 63 ++---- .../reference/arrayAssignmentTest3.errors.txt | 4 +- .../reference/arrayAssignmentTest4.errors.txt | 12 +- .../reference/arrayAssignmentTest5.errors.txt | 7 +- .../baselines/reference/arrayFrom.errors.txt | 7 +- .../reference/arrayLiterals3.errors.txt | 18 +- ...typeIsAssignableToReadonlyArray.errors.txt | 7 +- ...ambdaToNominalSubtypeOfFunction.errors.txt | 10 +- ...signingFromObjectToAnythingElse.errors.txt | 20 +- .../reference/assignmentCompat1.errors.txt | 14 +- ...nmentCompatBetweenTupleAndArray.errors.txt | 6 +- .../reference/assignmentCompatBug2.errors.txt | 21 +- ...CompatFunctionsWithOptionalArgs.errors.txt | 5 +- ...gnmentCompatWithCallSignatures2.errors.txt | 56 +++-- ...gnmentCompatWithCallSignatures3.errors.txt | 13 +- ...tCompatWithConstructSignatures2.errors.txt | 56 +++-- ...tCompatWithConstructSignatures3.errors.txt | 13 +- ...ignmentCompatWithNumericIndexer.errors.txt | 13 +- ...gnmentCompatWithNumericIndexer2.errors.txt | 13 +- ...gnmentCompatWithNumericIndexer3.errors.txt | 14 +- ...ignmentCompatWithObjectMembers4.errors.txt | 21 +- ...ignmentCompatWithObjectMembers5.errors.txt | 14 +- ...atWithObjectMembersOptionality2.errors.txt | 63 +++--- ...ObjectMembersStringNumericNames.errors.txt | 203 ++++++++---------- ...signmentCompatWithStringIndexer.errors.txt | 13 +- ...ignmentCompatWithStringIndexer2.errors.txt | 13 +- ...ember-off-of-function-interface.errors.txt | 19 +- ...ember-off-of-function-interface.errors.txt | 19 +- .../assignmentToObjectAndFunction.errors.txt | 6 +- tests/baselines/reference/bases.errors.txt | 5 +- .../reference/bigintWithLib.errors.txt | 6 +- .../reference/bluebirdStaticThis.errors.txt | 5 +- .../reference/castingTuple.errors.txt | 15 +- .../reference/chainedAssignment1.errors.txt | 13 +- .../reference/chainedAssignment3.errors.txt | 7 +- .../chainedAssignmentChecking.errors.txt | 13 +- ...ConstrainedToOtherTypeParameter.errors.txt | 7 +- .../reference/checkJsdocTypeTag6.errors.txt | 7 +- .../checkJsxChildrenProperty14.errors.txt | 16 +- .../checkJsxChildrenProperty2.errors.txt | 89 +++----- .../checkJsxChildrenProperty5.errors.txt | 41 ++-- .../checkJsxChildrenProperty7.errors.txt | 62 +++--- ...assCanExtendConstructorFunction.errors.txt | 7 +- .../classImplementsClass2.errors.txt | 12 +- .../classImplementsClass4.errors.txt | 12 +- .../classImplementsClass7.errors.txt | 5 +- ...sImplementsMergedClassInterface.errors.txt | 14 +- .../classWithMultipleBaseClasses.errors.txt | 4 +- .../clodulesDerivedClasses.errors.txt | 7 +- ...onalOperatorWithoutIdenticalBCT.errors.txt | 14 +- .../reference/conditionalTypes2.errors.txt | 25 +-- .../reference/constraints0.errors.txt | 5 +- ...atureInstatiationContravariance.errors.txt | 7 +- .../contextualTypeWithTuple.errors.txt | 19 +- ...lTypeWithUnionTypeObjectLiteral.errors.txt | 7 +- .../reference/contextualTyping.errors.txt | 7 +- .../reference/contextualTyping11.errors.txt | 7 +- .../reference/contextualTyping5.errors.txt | 7 +- .../reference/covariantCallbacks.errors.txt | 7 +- ...ertyIsRelatableToTargetProperty.errors.txt | 7 +- .../declarationsAndAssignments.errors.txt | 6 +- .../decoratorOnClassMethod10.errors.txt | 4 +- .../deeplyNestedAssignabilityIssue.errors.txt | 22 +- ...rayBindingPatternAndAssignment2.errors.txt | 12 +- ...tructuringParameterDeclaration2.errors.txt | 11 +- ...cturingParameterDeclaration3ES5.errors.txt | 4 +- ...arameterDeclaration3ES5iterable.errors.txt | 4 +- ...cturingParameterDeclaration3ES6.errors.txt | 4 +- ...tructuringParameterDeclaration4.errors.txt | 4 +- ...tructuringParameterDeclaration5.errors.txt | 12 +- ...orExpressionsWhichCouldBeCalled.errors.txt | 13 +- .../differentTypesWithSameName.errors.txt | 5 +- .../reference/elaboratedErrors.errors.txt | 14 +- .../errorsWithInvokablesInUnions01.errors.txt | 7 +- ...AnnotationAndInvalidInitializer.errors.txt | 27 +-- .../excessPropertyCheckWithUnions.errors.txt | 7 +- .../exportDefaultStripsFreshness.errors.txt | 10 +- ...fixingTypeParametersRepeatedly2.errors.txt | 7 +- tests/baselines/reference/for-of31.errors.txt | 7 +- .../reference/functionOverloads41.errors.txt | 7 +- tests/baselines/reference/fuzzy.errors.txt | 10 +- .../reference/generatorTypeCheck18.errors.txt | 7 +- .../reference/generatorTypeCheck20.errors.txt | 7 +- .../reference/generatorTypeCheck25.errors.txt | 7 +- .../reference/generatorTypeCheck7.errors.txt | 7 +- .../genericArrayExtenstions.errors.txt | 4 +- ...thObjectTypeArgsAndConstraints3.errors.txt | 7 +- ...thObjectTypeArgsAndConstraints4.errors.txt | 5 +- ...thObjectTypeArgsAndConstraints5.errors.txt | 5 +- .../genericCallWithTupleType.errors.txt | 6 +- .../reference/genericConstraint2.errors.txt | 10 +- .../genericRestParameters2.errors.txt | 6 +- .../genericRestParameters3.errors.txt | 49 ++--- .../genericTypeAssertions2.errors.txt | 12 +- .../genericTypeConstraints.errors.txt | 5 +- .../baselines/reference/generics1.errors.txt | 5 +- .../baselines/reference/generics2.errors.txt | 5 +- .../baselines/reference/generics5.errors.txt | 5 +- ...rfaceExtendingClassWithPrivates.errors.txt | 9 +- ...faceExtendingClassWithPrivates2.errors.txt | 25 ++- ...aceExtendingClassWithProtecteds.errors.txt | 14 +- ...tCallExpressionCheckReturntype1.errors.txt | 14 +- .../reference/incompatibleTypes.errors.txt | 6 +- .../reference/inheritance1.errors.txt | 80 ++++--- ...sxFactoryDeclarationsLocalTypes.errors.txt | 19 +- ...xFactoryLocalTypeGlobalFallback.errors.txt | 7 +- .../reference/intTypeCheck.errors.txt | 50 ++--- .../interfaceAssignmentCompat.errors.txt | 7 +- .../interfaceDeclaration1.errors.txt | 5 +- .../interfaceDeclaration4.errors.txt | 10 +- ...terfaceExtendsClassWithPrivate1.errors.txt | 20 +- .../interfaceImplementation2.errors.txt | 5 +- .../interfaceImplementation3.errors.txt | 5 +- .../interfaceImplementation4.errors.txt | 5 +- .../interfaceImplementation6.errors.txt | 5 +- .../reference/interfaceInheritance.errors.txt | 10 +- .../intersectionAndUnionTypes.errors.txt | 77 +++---- .../intersectionAsWeakTypeSource.errors.txt | 6 +- .../intersectionTypeAssignment.errors.txt | 28 ++- .../invalidReturnStatements.errors.txt | 13 +- ...nvariantGenericErrorElaboration.errors.txt | 1 + .../iterableArrayPattern10.errors.txt | 4 +- .../iterableArrayPattern13.errors.txt | 4 +- .../iterableArrayPattern16.errors.txt | 4 +- .../iterableArrayPattern17.errors.txt | 5 +- .../iterableArrayPattern18.errors.txt | 4 +- .../iterableArrayPattern19.errors.txt | 4 +- .../iterableArrayPattern26.errors.txt | 4 +- .../iterableArrayPattern7.errors.txt | 6 +- .../iteratorSpreadInArray9.errors.txt | 7 +- .../jsContainerMergeTsDeclaration3.errors.txt | 6 +- .../reference/jsdocFunctionType.errors.txt | 7 +- .../reference/jsdocTemplateTag3.errors.txt | 5 +- .../reference/jsdocTypeTagCast.errors.txt | 19 +- .../reference/mappedTypeErrors.errors.txt | 5 +- .../reference/mappedTypes6.errors.txt | 26 +-- ...nterfacesWithInheritedPrivates2.errors.txt | 5 +- ...wingGenericTypeFromInstanceof01.errors.txt | 5 +- .../noImplicitAnyInCastExpression.errors.txt | 4 +- .../nonIterableRestElement3.errors.txt | 7 +- .../nonPrimitiveAssignError.errors.txt | 7 +- ...eralFunctionArgContextualTyping.errors.txt | 10 +- ...ralFunctionArgContextualTyping2.errors.txt | 5 +- .../objectLiteralIndexerErrors.errors.txt | 7 +- .../objectLiteralNormalization.errors.txt | 19 +- ...handPropertiesFunctionArgument2.errors.txt | 5 +- .../baselines/reference/objectRest.errors.txt | 6 +- .../reference/objectSpreadNegative.errors.txt | 14 +- ...bjectTypesIdentityWithPrivates3.errors.txt | 5 +- .../optionalPropertiesInClasses.errors.txt | 5 +- .../optionalPropertiesTest.errors.txt | 21 +- .../overloadingOnConstants1.errors.txt | 28 ++- ...nWithConstraintCheckingDeferred.errors.txt | 12 +- .../overloadsWithProvisionalErrors.errors.txt | 13 +- .../reference/promisePermutations.errors.txt | 7 +- .../reference/promisePermutations2.errors.txt | 7 +- .../reference/promisePermutations3.errors.txt | 14 +- .../promisesWithConstraints.errors.txt | 7 +- tests/baselines/reference/qualify.errors.txt | 27 +-- .../recursiveClassReferenceTest.errors.txt | 5 +- .../recursiveInheritance3.errors.txt | 5 +- .../recursiveIntersectionTypes.errors.txt | 7 +- .../requireOfJsonFileInJsFile.errors.txt | 14 +- .../reference/restTupleElements1.errors.txt | 16 +- .../restTuplesFromContextualTypes.errors.txt | 6 +- ...cMemberOfAnotherClassAssignment.errors.txt | 28 ++- .../reference/strictBindCallApply1.errors.txt | 4 +- .../strictFunctionTypesErrors.errors.txt | 7 +- .../reference/strictTupleLength.errors.txt | 6 +- ...ConstrainsPropertyDeclarations2.errors.txt | 14 +- .../subtypingWithNumericIndexer2.errors.txt | 7 +- .../subtypingWithNumericIndexer3.errors.txt | 7 +- .../subtypingWithNumericIndexer4.errors.txt | 5 +- .../subtypingWithNumericIndexer5.errors.txt | 5 +- .../subtypingWithObjectMembers3.errors.txt | 7 +- .../subtypingWithObjectMembers5.errors.txt | 15 +- .../subtypingWithStringIndexer2.errors.txt | 7 +- .../subtypingWithStringIndexer3.errors.txt | 7 +- .../subtypingWithStringIndexer4.errors.txt | 5 +- .../reference/symbolProperty10.errors.txt | 7 +- .../reference/symbolProperty25.errors.txt | 5 +- .../reference/symbolProperty52.errors.txt | 7 +- .../reference/symbolProperty9.errors.txt | 7 +- ...eStringsWithOverloadResolution1.errors.txt | 5 +- ...ingsWithOverloadResolution1_ES6.errors.txt | 5 +- ...tringsArrayTypeDefinedInES5Mode.errors.txt | 4 +- ...ringsArrayTypeNotDefinedES5Mode.errors.txt | 4 +- ...ingsArrayTypeRedefinedInES6Mode.errors.txt | 4 +- .../thisTypeInFunctionsNegative.errors.txt | 31 ++- .../tsxAttributeResolution1.errors.txt | 7 +- .../tsxAttributeResolution12.errors.txt | 14 +- .../tsxAttributeResolution3.errors.txt | 7 +- .../tsxAttributeResolution5.errors.txt | 14 +- .../tsxAttributeResolution6.errors.txt | 7 +- .../tsxInvokeComponentType.errors.txt | 9 +- .../tsxLibraryManagedAttributes.errors.txt | 12 +- .../tsxNotUsingApparentTypeOfSFC.errors.txt | 12 +- ...ponentWithDefaultTypeParameter3.errors.txt | 8 +- ...tsxSpreadAttributesResolution12.errors.txt | 14 +- ...tsxSpreadAttributesResolution16.errors.txt | 7 +- .../tsxSpreadAttributesResolution2.errors.txt | 14 +- .../tsxSpreadAttributesResolution6.errors.txt | 9 +- ...elessFunctionComponentOverload4.errors.txt | 18 +- ...tsxStatelessFunctionComponents1.errors.txt | 9 +- ...ionComponentsWithTypeArguments4.errors.txt | 16 +- .../reference/tsxUnionElementType6.errors.txt | 18 +- .../baselines/reference/tupleTypes.errors.txt | 12 +- ...ntInferenceWithClassExpression2.errors.txt | 7 +- ...renceWithConstraintAsCommonRoot.errors.txt | 5 +- .../reference/typeAssertions.errors.txt | 19 +- ...sertionsWithIntersectionTypes01.errors.txt | 7 +- .../typeGuardFunctionErrors.errors.txt | 14 +- ...peGuardFunctionOfFormThisErrors.errors.txt | 14 +- .../baselines/reference/typeMatch1.errors.txt | 7 +- .../baselines/reference/typeMatch2.errors.txt | 27 +-- .../typeParamExtendsOtherTypeParam.errors.txt | 25 ++- ...gWithContextSensitiveArguments2.errors.txt | 7 +- ...gWithContextSensitiveArguments3.errors.txt | 7 +- .../reference/typeRelationships.errors.txt | 6 +- .../typedefMultipleTypeParameters.errors.txt | 10 +- .../typeofAmbientExternalModules.errors.txt | 13 +- .../typeofExternalModules.errors.txt | 13 +- .../typeofInternalModules.errors.txt | 14 +- .../types.asyncGenerators.esnext.2.errors.txt | 20 +- ...yExternalModuleStillHasInstance.errors.txt | 7 +- ...unionTypeErrorMessageTypeRefs01.errors.txt | 21 +- ...eWithRecursiveSubtypeReduction2.errors.txt | 14 +- .../unionTypesAssignability.errors.txt | 28 ++- ...unctionCallsWithTypeParameters1.errors.txt | 4 +- 237 files changed, 1494 insertions(+), 1856 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 26507b31ea1..17bb5e193e5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -434,6 +434,8 @@ namespace ts { const numberOrBigIntType = getUnionType([numberType, bigintType]); const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + emptyJsxObjectType.objectFlags |= ObjectFlags.JsxAttributes; const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type); emptyTypeLiteralSymbol.members = createSymbolTable(); @@ -11407,6 +11409,7 @@ namespace ts { ): boolean { let errorInfo: DiagnosticMessageChain | undefined; + let relatedInfo: [DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined; let maybeKeys: string[]; let sourceStack: Type[]; let targetStack: Type[]; @@ -11414,6 +11417,7 @@ namespace ts { let depth = 0; let expandingFlags = ExpandingFlags.None; let overflow = false; + let suppressNextError = false; Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); @@ -11444,6 +11448,9 @@ namespace ts { } const diag = createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation); + if (relatedInfo) { + addRelatedInfo(diag, ...relatedInfo); + } if (errorOutputContainer) { errorOutputContainer.error = diag; } @@ -11451,9 +11458,19 @@ namespace ts { } return result !== Ternary.False; - function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string, arg2?: string): void { + function reportError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void { Debug.assert(!!errorNode); - errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3); + } + + function associateRelatedInfo(info: DiagnosticRelatedInformation) { + Debug.assert(!!errorInfo); + if (!relatedInfo) { + relatedInfo = [info]; + } + else { + relatedInfo.push(info); + } } function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) { @@ -11661,13 +11678,15 @@ namespace ts { } if (!result && reportErrors) { + const maybeSuppress = suppressNextError; + suppressNextError = false; if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); } else if (source.symbol && source.flags & TypeFlags.Object && globalObjectType === source) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); } - else if (getObjectFlags(source) & ObjectFlags.JsxAttributes && target.flags & TypeFlags.Intersection) { + else if (isComparingJsxAttributes && target.flags & TypeFlags.Intersection) { const targetTypes = (target as IntersectionType).types; const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode); const intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode); @@ -11677,6 +11696,10 @@ namespace ts { return result; } } + if (!headMessage && maybeSuppress) { + // Used by, eg, missing property checking to replace the top-level message with a more informative one + return result; + } reportRelationError(headMessage, source, target); } return result; @@ -12310,7 +12333,24 @@ namespace ts { const unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties); if (unmatchedProperty) { if (reportErrors) { - reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(unmatchedProperty), typeToString(source)); + const props = arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties)); + if (!headMessage || (headMessage.code !== Diagnostics.Class_0_incorrectly_implements_interface_1.code && + headMessage.code !== Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { + suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it + } + if (props.length === 1) { + const propName = symbolToString(unmatchedProperty); + reportError(Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target)); + if (length(unmatchedProperty.declarations)) { + associateRelatedInfo(createDiagnosticForNode(unmatchedProperty.declarations[0], Diagnostics._0_is_declared_here, propName)); + } + } + else if (props.length > 5) { // arbitrary cutoff for too-long list form + reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), map(props.slice(0, 4), p => symbolToString(p)).join(", "), props.length - 4); + } + else { + reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), map(props, p => symbolToString(p)).join(", ")); + } } return Ternary.False; } @@ -13701,17 +13741,20 @@ namespace ts { return getTypeFromInference(inference); } - function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean) { + function* getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean) { const properties = target.flags & TypeFlags.Intersection ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target); for (const targetProp of properties) { if (requireOptionalProperties || !(targetProp.flags & SymbolFlags.Optional)) { const sourceProp = getPropertyOfType(source, targetProp.escapedName); if (!sourceProp) { - return targetProp; + yield targetProp; } } } - return undefined; + } + + function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean): Symbol | undefined { + return getUnmatchedProperties(source, target, requireOptionalProperties).next().value; } function tupleTypesDefinitelyUnrelated(source: TupleTypeReference, target: TupleTypeReference) { @@ -17914,7 +17957,7 @@ namespace ts { function createJsxAttributesTypeFromAttributesProperty(openingLikeElement: JsxOpeningLikeElement, checkMode: CheckMode | undefined) { const attributes = openingLikeElement.attributes; let attributesTable = createSymbolTable(); - let spread: Type = emptyObjectType; + let spread: Type = emptyJsxObjectType; let hasSpreadAnyType = false; let typeToIntersect: Type | undefined; let explicitlySpecifyChildrenAttribute = false; @@ -17998,10 +18041,10 @@ namespace ts { if (hasSpreadAnyType) { return anyType; } - if (typeToIntersect && spread !== emptyObjectType) { + if (typeToIntersect && spread !== emptyJsxObjectType) { return getIntersectionType([typeToIntersect, spread]); } - return typeToIntersect || (spread === emptyObjectType ? createJsxAttributesType() : spread); + return typeToIntersect || (spread === emptyJsxObjectType ? createJsxAttributesType() : spread); /** * Create anonymous type from given attributes symbol table. diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3dc2735d004..4fe6674d3f5 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1268,9 +1268,9 @@ namespace ts { } /** Shims `Array.from`. */ - export function arrayFrom(iterator: Iterator, map: (t: T) => U): U[]; - export function arrayFrom(iterator: Iterator): T[]; - export function arrayFrom(iterator: Iterator, map?: (t: any) => any): any[] { + export function arrayFrom(iterator: Iterator | IterableIterator, map: (t: T) => U): U[]; + export function arrayFrom(iterator: Iterator | IterableIterator): T[]; + export function arrayFrom(iterator: Iterator | IterableIterator, map?: (t: any) => any): any[] { const result: any[] = []; for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) { result.push(map ? map(value) : value); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3ba74f03073..bfa8108ef02 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2513,6 +2513,18 @@ "category": "Message", "code": 2738 }, + "Type '{0}' is missing the following properties from type '{1}': {2}": { + "category": "Error", + "code": 2739 + }, + "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.": { + "category": "Error", + "code": 2740 + }, + "Property '{0}' is missing in type '{1}' but required in type '{2}'.": { + "category": "Error", + "code": 2741 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 0cc32767d7a..f0d43be624a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6980,8 +6980,8 @@ namespace ts { getSourceMapSourceConstructor: () => SourceMapSource, }; - export function formatStringFromArgs(text: string, args: ArrayLike, baseIndex = 0): string { - return text.replace(/{(\d+)}/g, (_match, index: string) => Debug.assertDefined(args[+index + baseIndex])); + export function formatStringFromArgs(text: string, args: ArrayLike, baseIndex = 0): string { + return text.replace(/{(\d+)}/g, (_match, index: string) => "" + Debug.assertDefined(args[+index + baseIndex])); } export let localizedDiagnosticMessages: MapLike | undefined; @@ -7060,7 +7060,7 @@ namespace ts { }; } - export function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage, ...args: (string | undefined)[]): DiagnosticMessageChain; + export function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticMessageChain; export function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage): DiagnosticMessageChain { let text = getLocaleSpecificMessage(message); diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index d1d0afb9059..bbad3e03824 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -4,6 +4,9 @@ namespace ts.codefix { const errorCodes = [ Diagnostics.Property_0_does_not_exist_on_type_1.code, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, + Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code, + Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code, + Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code ]; const fixId = "addMissingMember"; registerCodeFix({ diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.errors.txt b/tests/baselines/reference/argumentExpressionContextualTyping.errors.txt index 87c3a6d0b37..c983abfa1be 100644 --- a/tests/baselines/reference/argumentExpressionContextualTyping.errors.txt +++ b/tests/baselines/reference/argumentExpressionContextualTyping.errors.txt @@ -1,12 +1,11 @@ tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(16,5): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'. - Property '0' is missing in type '(string | number | boolean)[]'. + Type '(string | number | boolean)[]' is missing the following properties from type '[string, number, boolean]': 0, 1, 2 tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(17,5): error TS2345: Argument of type '[string, number, true, ...(string | number | boolean)[]]' is not assignable to parameter of type '[string, number, boolean]'. Types of property 'length' are incompatible. Type 'number' is not assignable to type '3'. tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(18,5): error TS2345: Argument of type '{ x: (string | number)[]; y: { c: boolean; d: string; e: number; }; }' is not assignable to parameter of type '{ x: [any, any]; y: { c: any; d: any; e: any; }; }'. Types of property 'x' are incompatible. - Type '(string | number)[]' is not assignable to type '[any, any]'. - Property '0' is missing in type '(string | number)[]'. + Type '(string | number)[]' is missing the following properties from type '[any, any]': 0, 1 ==== tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts (3 errors) ==== @@ -28,7 +27,7 @@ tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextua baz(array); // Error ~~~~~ !!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'. -!!! error TS2345: Property '0' is missing in type '(string | number | boolean)[]'. +!!! error TS2345: Type '(string | number | boolean)[]' is missing the following properties from type '[string, number, boolean]': 0, 1, 2 baz(["string", 1, true, ...array]); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[string, number, true, ...(string | number | boolean)[]]' is not assignable to parameter of type '[string, number, boolean]'. @@ -38,5 +37,4 @@ tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextua ~ !!! error TS2345: Argument of type '{ x: (string | number)[]; y: { c: boolean; d: string; e: number; }; }' is not assignable to parameter of type '{ x: [any, any]; y: { c: any; d: any; e: any; }; }'. !!! error TS2345: Types of property 'x' are incompatible. -!!! error TS2345: Type '(string | number)[]' is not assignable to type '[any, any]'. -!!! error TS2345: Property '0' is missing in type '(string | number)[]'. \ No newline at end of file +!!! error TS2345: Type '(string | number)[]' is missing the following properties from type '[any, any]': 0, 1 \ No newline at end of file diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt index f30dabd5689..50678ea4bb3 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt +++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt @@ -2,41 +2,32 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,12): erro tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(16,12): error TS2460: Type 'StrNum' has no property '2'. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,5): error TS2461: Type '{ 0: string; 1: number; length: 2; }' is not an array type. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,12): error TS2460: Type '{ 0: string; 1: number; length: 2; }' has no property '2'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. - Property '2' is missing in type '[string, number]'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. - Property '2' is missing in type 'StrNum'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, number, number]'. - Property '2' is missing in type '{ 0: string; 1: number; length: 2; }'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. - Property '2' is missing in type '[string, number]'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. - Property '2' is missing in type 'StrNum'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string, number, number]'. - Property '2' is missing in type '{ 0: string; 1: number; length: 2; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2741: Property '2' is missing in type '[string, number]' but required in type '[number, number, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2741: Property '2' is missing in type 'StrNum' but required in type '[number, number, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, number, number]': 2, pop, push, concat, and 16 more. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2741: Property '2' is missing in type '[string, number]' but required in type '[string, number, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2741: Property '2' is missing in type 'StrNum' but required in type '[string, number, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string, number, number]': 2, pop, push, concat, and 16 more. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'. Types of property '0' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'. Types of property '0' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'. - Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number]': pop, push, concat, join, and 15 more. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'. Types of property 'length' are incompatible. Type '2' is not assignable to type '1'. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'. Types of property 'length' are incompatible. Type '2' is not assignable to type '1'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'. - Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string]': pop, push, concat, join, and 15 more. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(31,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. Types of property '0' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'. - Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, string]': pop, push, concat, join, and 15 more. ==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (19 errors) ==== @@ -67,28 +58,22 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error !!! error TS2460: Type '{ 0: string; 1: number; length: 2; }' has no property '2'. var j1: [number, number, number] = x; ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. -!!! error TS2322: Property '2' is missing in type '[string, number]'. +!!! error TS2741: Property '2' is missing in type '[string, number]' but required in type '[number, number, number]'. var j2: [number, number, number] = y; ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. -!!! error TS2322: Property '2' is missing in type 'StrNum'. +!!! error TS2741: Property '2' is missing in type 'StrNum' but required in type '[number, number, number]'. var j3: [number, number, number] = z; ~~ -!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, number, number]'. -!!! error TS2322: Property '2' is missing in type '{ 0: string; 1: number; length: 2; }'. +!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, number, number]': 2, pop, push, concat, and 16 more. var k1: [string, number, number] = x; ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type '[string, number]'. +!!! error TS2741: Property '2' is missing in type '[string, number]' but required in type '[string, number, number]'. var k2: [string, number, number] = y; ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type 'StrNum'. +!!! error TS2741: Property '2' is missing in type 'StrNum' but required in type '[string, number, number]'. var k3: [string, number, number] = z; ~~ -!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type '{ 0: string; 1: number; length: 2; }'. +!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string, number, number]': 2, pop, push, concat, and 16 more. var l1: [number] = x; ~~ !!! error TS2322: Type '[string, number]' is not assignable to type '[number]'. @@ -101,8 +86,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error !!! error TS2322: Type 'string' is not assignable to type 'number'. var l3: [number] = z; ~~ -!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'. -!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number]': pop, push, concat, join, and 15 more. var m1: [string] = x; ~~ !!! error TS2322: Type '[string, number]' is not assignable to type '[string]'. @@ -115,8 +99,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error !!! error TS2322: Type '2' is not assignable to type '1'. var m3: [string] = z; ~~ -!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'. -!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[string]': pop, push, concat, join, and 15 more. var n1: [number, string] = x; ~~ !!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. @@ -128,8 +111,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error !!! error TS2322: Type 'string' is not assignable to type 'number'. var n3: [number, string] = z; ~~ -!!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number, string]'. -!!! error TS2322: Property 'pop' is missing in type '{ 0: string; 1: number; length: 2; }'. +!!! error TS2740: Type '{ 0: string; 1: number; length: 2; }' is missing the following properties from type '[number, string]': pop, push, concat, join, and 15 more. var o1: [string, number] = x; var o2: [string, number] = y; var o3: [string, number] = y; diff --git a/tests/baselines/reference/arrayAssignmentTest1.errors.txt b/tests/baselines/reference/arrayAssignmentTest1.errors.txt index e07306b19b2..4ee34fcf736 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest1.errors.txt @@ -1,50 +1,31 @@ -tests/cases/compiler/arrayAssignmentTest1.ts(46,5): error TS2322: Type 'undefined[]' is not assignable to type 'I1'. - Property 'IM1' is missing in type 'undefined[]'. -tests/cases/compiler/arrayAssignmentTest1.ts(47,5): error TS2322: Type 'undefined[]' is not assignable to type 'C1'. - Property 'IM1' is missing in type 'undefined[]'. -tests/cases/compiler/arrayAssignmentTest1.ts(48,5): error TS2322: Type 'undefined[]' is not assignable to type 'C2'. - Property 'C2M1' is missing in type 'undefined[]'. -tests/cases/compiler/arrayAssignmentTest1.ts(49,5): error TS2322: Type 'undefined[]' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'undefined[]'. +tests/cases/compiler/arrayAssignmentTest1.ts(46,5): error TS2741: Property 'IM1' is missing in type 'undefined[]' but required in type 'I1'. +tests/cases/compiler/arrayAssignmentTest1.ts(47,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1 +tests/cases/compiler/arrayAssignmentTest1.ts(48,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1 +tests/cases/compiler/arrayAssignmentTest1.ts(49,5): error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'. tests/cases/compiler/arrayAssignmentTest1.ts(60,1): error TS2322: Type 'C3[]' is not assignable to type 'I1[]'. - Type 'C3' is not assignable to type 'I1'. - Property 'IM1' is missing in type 'C3'. + Property 'IM1' is missing in type 'C3' but required in type 'I1'. tests/cases/compiler/arrayAssignmentTest1.ts(64,1): error TS2322: Type 'I1[]' is not assignable to type 'C1[]'. - Type 'I1' is not assignable to type 'C1'. - Property 'C1M1' is missing in type 'I1'. + Property 'C1M1' is missing in type 'I1' but required in type 'C1'. tests/cases/compiler/arrayAssignmentTest1.ts(65,1): error TS2322: Type 'C3[]' is not assignable to type 'C1[]'. - Type 'C3' is not assignable to type 'C1'. - Property 'IM1' is missing in type 'C3'. + Type 'C3' is missing the following properties from type 'C1': IM1, C1M1 tests/cases/compiler/arrayAssignmentTest1.ts(68,1): error TS2322: Type 'C1[]' is not assignable to type 'C2[]'. - Type 'C1' is not assignable to type 'C2'. - Property 'C2M1' is missing in type 'C1'. + Property 'C2M1' is missing in type 'C1' but required in type 'C2'. tests/cases/compiler/arrayAssignmentTest1.ts(69,1): error TS2322: Type 'I1[]' is not assignable to type 'C2[]'. - Type 'I1' is not assignable to type 'C2'. - Property 'C2M1' is missing in type 'I1'. + Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1 tests/cases/compiler/arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is not assignable to type 'C2[]'. - Type 'C3' is not assignable to type 'C2'. - Property 'C2M1' is missing in type 'C3'. + Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1 tests/cases/compiler/arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. - Type 'C2' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'C2'. + Property 'CM3M1' is missing in type 'C2' but required in type 'C3'. tests/cases/compiler/arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. - Type 'C1' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'C1'. + Property 'CM3M1' is missing in type 'C1' but required in type 'C3'. tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. - Type 'I1' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'I1'. -tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'. - Property 'pop' is missing in type '() => C1'. -tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'. - Property 'length' is missing in type '{ one: number; }'. -tests/cases/compiler/arrayAssignmentTest1.ts(82,1): error TS2322: Type 'C1' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C1'. -tests/cases/compiler/arrayAssignmentTest1.ts(83,1): error TS2322: Type 'C2' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C2'. -tests/cases/compiler/arrayAssignmentTest1.ts(84,1): error TS2322: Type 'C3' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C3'. -tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is not assignable to type 'any[]'. - Property 'length' is missing in type 'I1'. + Property 'CM3M1' is missing in type 'I1' but required in type 'C3'. +tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2740: Type '() => C1' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. +tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2740: Type '{ one: number; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest1.ts(82,1): error TS2740: Type 'C1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest1.ts(83,1): error TS2740: Type 'C2' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest1.ts(84,1): error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2740: Type 'I1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. ==== tests/cases/compiler/arrayAssignmentTest1.ts (19 errors) ==== @@ -95,20 +76,18 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n var i1_error: I1 = []; // should be an error - is ~~~~~~~~ -!!! error TS2322: Type 'undefined[]' is not assignable to type 'I1'. -!!! error TS2322: Property 'IM1' is missing in type 'undefined[]'. +!!! error TS2741: Property 'IM1' is missing in type 'undefined[]' but required in type 'I1'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:2:2: 'IM1' is declared here. var c1_error: C1 = []; // should be an error - is ~~~~~~~~ -!!! error TS2322: Type 'undefined[]' is not assignable to type 'C1'. -!!! error TS2322: Property 'IM1' is missing in type 'undefined[]'. +!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1 var c2_error: C2 = []; // should be an error - is ~~~~~~~~ -!!! error TS2322: Type 'undefined[]' is not assignable to type 'C2'. -!!! error TS2322: Property 'C2M1' is missing in type 'undefined[]'. +!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1 var c3_error: C3 = []; // should be an error - is ~~~~~~~~ -!!! error TS2322: Type 'undefined[]' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'undefined[]'. +!!! error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:14:5: 'CM3M1' is declared here. arr_any = arr_i1; // should be ok - is @@ -122,38 +101,35 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n arr_i1 = arr_c3; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C3[]' is not assignable to type 'I1[]'. -!!! error TS2322: Type 'C3' is not assignable to type 'I1'. -!!! error TS2322: Property 'IM1' is missing in type 'C3'. +!!! error TS2322: Property 'IM1' is missing in type 'C3' but required in type 'I1'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:2:2: 'IM1' is declared here. arr_c1 = arr_c1; // should be ok - subtype relationship - is arr_c1 = arr_c2; // should be ok - subtype relationship - is arr_c1 = arr_i1; // should be an error - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C1[]'. -!!! error TS2322: Type 'I1' is not assignable to type 'C1'. -!!! error TS2322: Property 'C1M1' is missing in type 'I1'. +!!! error TS2322: Property 'C1M1' is missing in type 'I1' but required in type 'C1'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:7:2: 'C1M1' is declared here. arr_c1 = arr_c3; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C3[]' is not assignable to type 'C1[]'. -!!! error TS2322: Type 'C3' is not assignable to type 'C1'. -!!! error TS2322: Property 'IM1' is missing in type 'C3'. +!!! error TS2322: Type 'C3' is missing the following properties from type 'C1': IM1, C1M1 arr_c2 = arr_c2; // should be ok - subtype relationship - is arr_c2 = arr_c1; // should be an error - subtype relationship - is ~~~~~~ !!! error TS2322: Type 'C1[]' is not assignable to type 'C2[]'. -!!! error TS2322: Type 'C1' is not assignable to type 'C2'. -!!! error TS2322: Property 'C2M1' is missing in type 'C1'. +!!! error TS2322: Property 'C2M1' is missing in type 'C1' but required in type 'C2'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:10:5: 'C2M1' is declared here. arr_c2 = arr_i1; // should be an error - subtype relationship - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C2[]'. -!!! error TS2322: Type 'I1' is not assignable to type 'C2'. -!!! error TS2322: Property 'C2M1' is missing in type 'I1'. +!!! error TS2322: Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1 arr_c2 = arr_c3; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C3[]' is not assignable to type 'C2[]'. -!!! error TS2322: Type 'C3' is not assignable to type 'C2'. -!!! error TS2322: Property 'C2M1' is missing in type 'C3'. +!!! error TS2322: Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1 // "clean up bug" occurs at this point // if you move these three expressions to another file, they raise an error @@ -161,41 +137,35 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n arr_c3 = arr_c2_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'C2' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'C2'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C2' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:14:5: 'CM3M1' is declared here. arr_c3 = arr_c1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'C1' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'C1'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C1' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:14:5: 'CM3M1' is declared here. arr_c3 = arr_i1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'I1' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'I1'. +!!! error TS2322: Property 'CM3M1' is missing in type 'I1' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest1.ts:14:5: 'CM3M1' is declared here. arr_any = f1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type '() => C1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'pop' is missing in type '() => C1'. +!!! error TS2740: Type '() => C1' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. arr_any = o1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type '{ one: number; }'. +!!! error TS2740: Type '{ one: number; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C1'. +!!! error TS2740: Type 'C1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = c2; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C2' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C2'. +!!! error TS2740: Type 'C2' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = c3; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C3' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C3'. +!!! error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = i1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'I1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'I1'. \ No newline at end of file +!!! error TS2740: Type 'I1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest2.errors.txt b/tests/baselines/reference/arrayAssignmentTest2.errors.txt index eca2f8ad6f5..4333dd119d6 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest2.errors.txt @@ -1,26 +1,16 @@ tests/cases/compiler/arrayAssignmentTest2.ts(47,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. - Type 'C2' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'C2'. + Property 'CM3M1' is missing in type 'C2' but required in type 'C3'. tests/cases/compiler/arrayAssignmentTest2.ts(48,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. - Type 'C1' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'C1'. + Property 'CM3M1' is missing in type 'C1' but required in type 'C3'. tests/cases/compiler/arrayAssignmentTest2.ts(49,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. - Type 'I1' is not assignable to type 'C3'. - Property 'CM3M1' is missing in type 'I1'. -tests/cases/compiler/arrayAssignmentTest2.ts(51,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'. - Property 'pop' is missing in type '() => C1'. -tests/cases/compiler/arrayAssignmentTest2.ts(52,1): error TS2322: Type '() => any' is not assignable to type 'any[]'. - Property 'pop' is missing in type '() => any'. -tests/cases/compiler/arrayAssignmentTest2.ts(53,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'. - Property 'length' is missing in type '{ one: number; }'. -tests/cases/compiler/arrayAssignmentTest2.ts(55,1): error TS2322: Type 'C1' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C1'. -tests/cases/compiler/arrayAssignmentTest2.ts(56,1): error TS2322: Type 'C2' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C2'. -tests/cases/compiler/arrayAssignmentTest2.ts(57,1): error TS2322: Type 'C3' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C3'. -tests/cases/compiler/arrayAssignmentTest2.ts(58,1): error TS2322: Type 'I1' is not assignable to type 'any[]'. - Property 'length' is missing in type 'I1'. + Property 'CM3M1' is missing in type 'I1' but required in type 'C3'. +tests/cases/compiler/arrayAssignmentTest2.ts(51,1): error TS2740: Type '() => C1' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. +tests/cases/compiler/arrayAssignmentTest2.ts(52,1): error TS2740: Type '() => any' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. +tests/cases/compiler/arrayAssignmentTest2.ts(53,1): error TS2740: Type '{ one: number; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest2.ts(55,1): error TS2740: Type 'C1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest2.ts(56,1): error TS2740: Type 'C2' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest2.ts(57,1): error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. +tests/cases/compiler/arrayAssignmentTest2.ts(58,1): error TS2740: Type 'I1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. ==== tests/cases/compiler/arrayAssignmentTest2.ts (10 errors) ==== @@ -73,46 +63,39 @@ tests/cases/compiler/arrayAssignmentTest2.ts(58,1): error TS2322: Type 'I1' is n arr_c3 = arr_c2_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'C2' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'C2'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C2' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest2.ts:14:2: 'CM3M1' is declared here. arr_c3 = arr_c1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'C1' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'C1'. +!!! error TS2322: Property 'CM3M1' is missing in type 'C1' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest2.ts:14:2: 'CM3M1' is declared here. arr_c3 = arr_i1_2; // should be an error - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]'. -!!! error TS2322: Type 'I1' is not assignable to type 'C3'. -!!! error TS2322: Property 'CM3M1' is missing in type 'I1'. +!!! error TS2322: Property 'CM3M1' is missing in type 'I1' but required in type 'C3'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest2.ts:14:2: 'CM3M1' is declared here. arr_any = f1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type '() => C1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'pop' is missing in type '() => C1'. +!!! error TS2740: Type '() => C1' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. arr_any = function () { return null;} // should be an error - is ~~~~~~~ -!!! error TS2322: Type '() => any' is not assignable to type 'any[]'. -!!! error TS2322: Property 'pop' is missing in type '() => any'. +!!! error TS2740: Type '() => any' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. arr_any = o1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type '{ one: number; }'. +!!! error TS2740: Type '{ one: number; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C1'. +!!! error TS2740: Type 'C1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = c2; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C2' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C2'. +!!! error TS2740: Type 'C2' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = c3; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C3' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C3'. +!!! error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr_any = i1; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'I1' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'I1'. +!!! error TS2740: Type 'I1' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest3.errors.txt b/tests/baselines/reference/arrayAssignmentTest3.errors.txt index 31347782c5d..04b49ff6daf 100644 --- a/tests/baselines/reference/arrayAssignmentTest3.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest3.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. - Property 'length' is missing in type 'B'. + Type 'B' is missing the following properties from type 'B[]': length, pop, push, concat, and 16 more. ==== tests/cases/compiler/arrayAssignmentTest3.ts (1 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of t var xx = new a(null, 7, new B()); ~~~~~~~ !!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. -!!! error TS2345: Property 'length' is missing in type 'B'. +!!! error TS2345: Type 'B' is missing the following properties from type 'B[]': length, pop, push, concat, and 16 more. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest4.errors.txt b/tests/baselines/reference/arrayAssignmentTest4.errors.txt index 2546c6abf04..3e1c6c3de12 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest4.errors.txt @@ -1,7 +1,5 @@ -tests/cases/compiler/arrayAssignmentTest4.ts(22,1): error TS2322: Type '() => any' is not assignable to type 'any[]'. - Property 'pop' is missing in type '() => any'. -tests/cases/compiler/arrayAssignmentTest4.ts(23,1): error TS2322: Type 'C3' is not assignable to type 'any[]'. - Property 'length' is missing in type 'C3'. +tests/cases/compiler/arrayAssignmentTest4.ts(22,1): error TS2740: Type '() => any' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. +tests/cases/compiler/arrayAssignmentTest4.ts(23,1): error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. ==== tests/cases/compiler/arrayAssignmentTest4.ts (2 errors) ==== @@ -28,10 +26,8 @@ tests/cases/compiler/arrayAssignmentTest4.ts(23,1): error TS2322: Type 'C3' is n arr_any = function () { return null;} // should be an error - is ~~~~~~~ -!!! error TS2322: Type '() => any' is not assignable to type 'any[]'. -!!! error TS2322: Property 'pop' is missing in type '() => any'. +!!! error TS2740: Type '() => any' is missing the following properties from type 'any[]': pop, push, concat, join, and 15 more. arr_any = c3; // should be an error - is ~~~~~~~ -!!! error TS2322: Type 'C3' is not assignable to type 'any[]'. -!!! error TS2322: Property 'length' is missing in type 'C3'. +!!! error TS2740: Type 'C3' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. \ No newline at end of file diff --git a/tests/baselines/reference/arrayAssignmentTest5.errors.txt b/tests/baselines/reference/arrayAssignmentTest5.errors.txt index 3a45cad9ad7..1a5c1ce4180 100644 --- a/tests/baselines/reference/arrayAssignmentTest5.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest5.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/arrayAssignmentTest5.ts(23,17): error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]'. - Type 'IToken' is not assignable to type 'IStateToken'. - Property 'state' is missing in type 'IToken'. + Property 'state' is missing in type 'IToken' but required in type 'IStateToken'. ==== tests/cases/compiler/arrayAssignmentTest5.ts (1 errors) ==== @@ -29,8 +28,8 @@ tests/cases/compiler/arrayAssignmentTest5.ts(23,17): error TS2322: Type 'IToken[ var tokens:IStateToken[]= lineTokens.tokens; ~~~~~~ !!! error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]'. -!!! error TS2322: Type 'IToken' is not assignable to type 'IStateToken'. -!!! error TS2322: Property 'state' is missing in type 'IToken'. +!!! error TS2322: Property 'state' is missing in type 'IToken' but required in type 'IStateToken'. +!!! related TS2728 tests/cases/compiler/arrayAssignmentTest5.ts:8:9: 'state' is declared here. if (tokens.length === 0) { return this.onEnter(line, tokens, offset); // <== this should produce an error since onEnter can not be called with (string, IStateToken[], offset) } diff --git a/tests/baselines/reference/arrayFrom.errors.txt b/tests/baselines/reference/arrayFrom.errors.txt index 4685ec20db8..615bd1bf769 100644 --- a/tests/baselines/reference/arrayFrom.errors.txt +++ b/tests/baselines/reference/arrayFrom.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/arrayFrom.ts(20,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'. - Type 'A' is not assignable to type 'B'. - Property 'b' is missing in type 'A'. + Property 'b' is missing in type 'A' but required in type 'B'. tests/cases/compiler/arrayFrom.ts(23,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'. @@ -27,8 +26,8 @@ tests/cases/compiler/arrayFrom.ts(23,7): error TS2322: Type 'A[]' is not assigna const result3: B[] = Array.from(inputA.values()); // expect error ~~~~~~~ !!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: Property 'b' is missing in type 'A'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 tests/cases/compiler/arrayFrom.ts:9:3: 'b' is declared here. const result4: A[] = Array.from(inputB, ({ b }): A => ({ a: b })); const result5: A[] = Array.from(inputALike); const result6: B[] = Array.from(inputALike); // expect error diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index d1c99742a27..4d398978c96 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2322: Type '[]' is not assignable to type '[any, any, any]'. - Property '0' is missing in type '[]'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2739: Type '[]' is missing the following properties from type '[any, any, any]': 0, 1, 2 tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,38): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,48): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'true' is not assignable to type 'number'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. Types of property 'length' are incompatible. Type '4' is not assignable to type '2'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'. - Property '0' is missing in type '(number[] | string[])[]'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. - Property '0' is missing in type 'number[]'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2739: Type '(number[] | string[])[]' is missing the following properties from type 'tup': 0, 1 +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2739: Type 'number[]' is missing the following properties from type '[number, number, number]': 0, 1, 2 tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. Types of property 'pop' are incompatible. Type '() => string | number' is not assignable to type '() => Number'. @@ -29,8 +26,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error var a0: [any, any, any] = []; // Error ~~ -!!! error TS2322: Type '[]' is not assignable to type '[any, any, any]'. -!!! error TS2322: Property '0' is missing in type '[]'. +!!! error TS2739: Type '[]' is missing the following properties from type '[any, any, any]': 0, 1, 2 var a1: [boolean, string, number] = ["string", 1, true]; // Error ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'boolean'. @@ -64,12 +60,10 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error interface myArray2 extends Array { } var c0: tup = [...temp2]; // Error ~~ -!!! error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'. -!!! error TS2322: Property '0' is missing in type '(number[] | string[])[]'. +!!! error TS2739: Type '(number[] | string[])[]' is missing the following properties from type 'tup': 0, 1 var c1: [number, number, number] = [...temp1]; // Error cannot assign number[] to [number, number, number] ~~ -!!! error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. -!!! error TS2322: Property '0' is missing in type 'number[]'. +!!! error TS2739: Type 'number[]' is missing the following properties from type '[number, number, number]': 0, 1, 2 var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] ~~ !!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt index 66a659b3863..319cc4310d8 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray'. - Type 'A' is not assignable to type 'B'. - Property 'b' is missing in type 'A'. + Property 'b' is missing in type 'A' but required in type 'B'. tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C' is not assignable to type 'ReadonlyArray'. Types of property 'concat' are incompatible. Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. @@ -24,8 +23,8 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T rrb = ara; // error: 'A' is not assignable to 'B' ~~~ !!! error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: Property 'b' is missing in type 'A'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts:2:21: 'b' is declared here. rra = cra; rra = crb; // OK, C is assignable to ReadonlyArray diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt index f462fd347e6..eeab9734ccd 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(7,4): error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. - Property 'x' is missing in type '(a: any, b: any) => boolean'. + Property 'x' is missing in type '(a: any, b: any) => boolean' but required in type 'IResultCallback'. tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(8,4): error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. - Property 'x' is missing in type '(a: any, b: any) => boolean'. + Property 'x' is missing in type '(a: any, b: any) => boolean' but required in type 'IResultCallback'. ==== tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts (2 errors) ==== @@ -14,9 +14,11 @@ tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(8,4): error TS234 fn((a, b) => true); ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. -!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. +!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean' but required in type 'IResultCallback'. +!!! related TS2728 tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts:2:5: 'x' is declared here. fn(function (a, b) { return true; }) ~~~~~~~~ !!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. -!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. +!!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean' but required in type 'IResultCallback'. +!!! related TS2728 tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts:2:5: 'x' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt index bc92c376c7c..0a7a3a2db5c 100644 --- a/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt +++ b/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt @@ -1,11 +1,9 @@ -tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'exec' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): 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 'RegExp': exec, test, source, global, and 4 more. tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,31): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,31): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'name' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,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 'Error': name, message ==== tests/cases/compiler/assigningFromObjectToAnythingElse.ts (4 errors) ==== @@ -13,9 +11,8 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Ty var y: RegExp; y = x; ~ -!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'exec' is missing in type 'Object'. +!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2696: Type 'Object' is missing the following properties from type 'RegExp': exec, test, source, global, and 4 more. var a: String = Object.create(""); ~~~~~~ @@ -26,7 +23,6 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Ty var w: Error = new Object(); ~ -!!! error TS2322: Type 'Object' is not assignable to type 'Error'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'name' is missing in type 'Object'. +!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2696: Type 'Object' is missing the following properties from type 'Error': name, message \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompat1.errors.txt b/tests/baselines/reference/assignmentCompat1.errors.txt index e9fc3bd2f7f..d393d553ce4 100644 --- a/tests/baselines/reference/assignmentCompat1.errors.txt +++ b/tests/baselines/reference/assignmentCompat1.errors.txt @@ -1,7 +1,5 @@ -tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: string]: any; }' is not assignable to type '{ one: number; }'. - Property 'one' is missing in type '{ [index: string]: any; }'. -tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'. - Property 'one' is missing in type '{ [index: number]: any; }'. +tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'. +tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'. tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type '"foo"' is not assignable to type '{ [index: string]: any; }'. tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is not assignable to type '{ [index: number]: any; }'. @@ -12,13 +10,13 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is n var z: { [index: number]: any }; x = y; // Error ~ -!!! error TS2322: Type '{ [index: string]: any; }' is not assignable to type '{ one: number; }'. -!!! error TS2322: Property 'one' is missing in type '{ [index: string]: any; }'. +!!! error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompat1.ts:1:11: 'one' is declared here. y = x; // Ok because index signature type is any x = z; // Error ~ -!!! error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'. -!!! error TS2322: Property 'one' is missing in type '{ [index: number]: any; }'. +!!! error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompat1.ts:1:11: 'one' is declared here. z = x; // Ok because index signature type is any y = "foo"; // Error ~ diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt index b17973302c6..0d6aea98daf 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt @@ -1,8 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]'. - Property '0' is missing in type '{}[]'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2741: Property '0' is missing in type '{}[]' but required in type '[{}]'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts (2 errors) ==== @@ -29,6 +28,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'string' is not assignable to type 'number'. emptyObjTuple = emptyObjArray; ~~~~~~~~~~~~~ -!!! error TS2322: Type '{}[]' is not assignable to type '[{}]'. -!!! error TS2322: Property '0' is missing in type '{}[]'. +!!! error TS2741: Property '0' is missing in type '{}[]' but required in type '[{}]'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt index 29ba96e6586..b8bd7d48473 100644 --- a/tests/baselines/reference/assignmentCompatBug2.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt @@ -4,12 +4,9 @@ tests/cases/compiler/assignmentCompatBug2.ts(3,8): error TS2322: Type '{ a: numb Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(5,13): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'. Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'. -tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. - Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. -tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. - Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. -tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. - Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. +tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2741: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2741: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2741: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. ==== tests/cases/compiler/assignmentCompatBug2.ts (6 errors) ==== @@ -38,16 +35,16 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: b3 = { ~~ -!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. -!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. +!!! error TS2741: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompatBug2.ts:7:55: 'm' is declared here. f: (n) => { return 0; }, g: (s) => { return 0; }, }; // error b3 = { ~~ -!!! error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. -!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. +!!! error TS2741: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompatBug2.ts:7:33: 'g' is declared here. f: (n) => { return 0; }, m: 0, }; // error @@ -62,8 +59,8 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: b3 = { ~~ -!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. -!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. +!!! error TS2741: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' but required in type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompatBug2.ts:7:55: 'm' is declared here. f: (n) => { return 0; }, g: (s) => { return 0; }, n: 0, diff --git a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt index 6686167cf1e..870c5f8839d 100644 --- a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt +++ b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,17): error TS2322: Type 'false' is not assignable to type 'string'. tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. - Property 'id' is missing in type '{ name: string; }'. + Property 'id' is missing in type '{ name: string; }' but required in type '{ id: number; name?: string; }'. ==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ==== @@ -17,4 +17,5 @@ tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS foo({ name: "hello" }); // Error, id required but missing ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. -!!! error TS2345: Property 'id' is missing in type '{ name: string; }'. \ No newline at end of file +!!! error TS2345: Property 'id' is missing in type '{ name: string; }' but required in type '{ id: number; name?: string; }'. +!!! related TS2728 tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts:1:19: 'id' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt index ffc0fdcd772..ba14424f99f 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(31,1): error TS2322: Type '() => number' is not assignable to type 'T'. - Property 'f' is missing in type '() => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(32,1): error TS2322: Type '(x: number) => string' is not assignable to type 'T'. - Property 'f' is missing in type '(x: number) => string'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(33,1): error TS2322: Type '() => number' is not assignable to type '{ f(x: number): void; }'. - Property 'f' is missing in type '() => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(34,1): error TS2322: Type '(x: number) => string' is not assignable to type '{ f(x: number): void; }'. - Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(31,1): error TS2741: Property 'f' is missing in type '() => number' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(32,1): error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(33,1): error TS2741: Property 'f' is missing in type '() => number' but required in type '{ f(x: number): void; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(34,1): error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type '{ f(x: number): void; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(42,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. @@ -16,10 +12,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(44,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. - Property 'f' is missing in type '(x: string) => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(45,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. - Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(44,1): error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(45,1): error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(46,1): error TS2322: Type 'S2' is not assignable to type '{ f(x: number): void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. @@ -30,10 +24,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(48,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. - Property 'f' is missing in type '(x: string) => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(49,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }'. - Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(48,1): error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type '{ f(x: number): void; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(49,1): error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type '{ f(x: number): void; }'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts (12 errors) ==== @@ -69,20 +61,20 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme // errors t = () => 1; ~ -!!! error TS2322: Type '() => number' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '() => number'. +!!! error TS2741: Property 'f' is missing in type '() => number' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:4:5: 'f' is declared here. t = function (x: number) { return ''; } ~ -!!! error TS2322: Type '(x: number) => string' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:4:5: 'f' is declared here. a = () => 1; ~ -!!! error TS2322: Type '() => number' is not assignable to type '{ f(x: number): void; }'. -!!! error TS2322: Property 'f' is missing in type '() => number'. +!!! error TS2741: Property 'f' is missing in type '() => number' but required in type '{ f(x: number): void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:7:10: 'f' is declared here. a = function (x: number) { return ''; } ~ -!!! error TS2322: Type '(x: number) => string' is not assignable to type '{ f(x: number): void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type '{ f(x: number): void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:7:10: 'f' is declared here. interface S2 { f(x: string): void; @@ -106,12 +98,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'number' is not assignable to type 'string'. t = (x: string) => 1; ~ -!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:4:5: 'f' is declared here. t = function (x: string) { return ''; } ~ -!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:4:5: 'f' is declared here. a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type '{ f(x: number): void; }'. @@ -128,10 +120,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x: string) => 1; ~ -!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type '{ f(x: number): void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:7:10: 'f' is declared here. a = function (x: string) { return ''; } ~ -!!! error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type '{ f(x: number): void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts:7:10: 'f' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt index 441810033d2..aeab1787439 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt @@ -35,14 +35,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(77,1): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. - Type 'Base' is not assignable to type '{ foo: string; bar: string; }'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type '{ foo: string; bar: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(80,1): error TS2322: Type '(x: Base[], y: Derived2[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => Derived[]'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type 'Derived2[]'. Type 'Base[]' is not assignable to type 'Derived2[]'. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(85,1): error TS2322: Type '(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => Object'. @@ -183,8 +181,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type '{ foo: string; bar: string; }'. -!!! error TS2322: Type 'Base' is not assignable to type '{ foo: string; bar: string; }'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type '{ foo: string; bar: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts:18:49: 'bar' is declared here. var b12: >(x: Array, y: T) => Array; a12 = b12; // ok b12 = a12; // ok @@ -193,8 +191,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'. !!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar var b13: >(x: Array, y: T) => T; a13 = b13; // ok b13 = a13; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt index 0155b8611c4..b42670aa902 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(23,1): error TS2322: Type '() => number' is not assignable to type 'T'. - Property 'f' is missing in type '() => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(24,1): error TS2322: Type '(x: number) => string' is not assignable to type 'T'. - Property 'f' is missing in type '(x: number) => string'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(25,1): error TS2322: Type '() => number' is not assignable to type '{ f: new (x: number) => void; }'. - Property 'f' is missing in type '() => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(26,1): error TS2322: Type '(x: number) => string' is not assignable to type '{ f: new (x: number) => void; }'. - Property 'f' is missing in type '(x: number) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(23,1): error TS2741: Property 'f' is missing in type '() => number' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(24,1): error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(25,1): error TS2741: Property 'f' is missing in type '() => number' but required in type '{ f: new (x: number) => void; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(26,1): error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type '{ f: new (x: number) => void; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. @@ -14,10 +10,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. - Property 'f' is missing in type '(x: string) => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. - Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. @@ -26,10 +20,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. - Property 'f' is missing in type '(x: string) => number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'. - Property 'f' is missing in type '(x: string) => string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type '{ f: new (x: number) => void; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type '{ f: new (x: number) => void; }'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts (12 errors) ==== @@ -57,20 +49,20 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme // errors t = () => 1; ~ -!!! error TS2322: Type '() => number' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '() => number'. +!!! error TS2741: Property 'f' is missing in type '() => number' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:4:5: 'f' is declared here. t = function (x: number) { return ''; } ~ -!!! error TS2322: Type '(x: number) => string' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:4:5: 'f' is declared here. a = () => 1; ~ -!!! error TS2322: Type '() => number' is not assignable to type '{ f: new (x: number) => void; }'. -!!! error TS2322: Property 'f' is missing in type '() => number'. +!!! error TS2741: Property 'f' is missing in type '() => number' but required in type '{ f: new (x: number) => void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:7:10: 'f' is declared here. a = function (x: number) { return ''; } ~ -!!! error TS2322: Type '(x: number) => string' is not assignable to type '{ f: new (x: number) => void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: number) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: number) => string' but required in type '{ f: new (x: number) => void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:7:10: 'f' is declared here. interface S2 { f(x: string): void; @@ -92,12 +84,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. t = (x: string) => 1; ~ -!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:4:5: 'f' is declared here. t = function (x: string) { return ''; } ~ -!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:4:5: 'f' is declared here. a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. @@ -112,10 +104,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. a = (x: string) => 1; ~ -!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => number'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => number' but required in type '{ f: new (x: number) => void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:7:10: 'f' is declared here. a = function (x: string) { return ''; } ~ -!!! error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'. -!!! error TS2322: Property 'f' is missing in type '(x: string) => string'. +!!! error TS2741: Property 'f' is missing in type '(x: string) => string' but required in type '{ f: new (x: number) => void; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts:7:10: 'f' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt index 3bce93635d0..1db469b6a4f 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt @@ -35,14 +35,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(77,1): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. - Type 'Base' is not assignable to type '{ foo: string; bar: string; }'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type '{ foo: string; bar: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(80,1): error TS2322: Type 'new (x: Base[], y: Derived2[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => Derived[]'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type 'Derived2[]'. Type 'Base[]' is not assignable to type 'Derived2[]'. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(85,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T' is not assignable to type 'new (x: { a: string; b: number; }) => Object'. @@ -183,8 +181,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type '{ foo: string; bar: string; }'. -!!! error TS2322: Type 'Base' is not assignable to type '{ foo: string; bar: string; }'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type '{ foo: string; bar: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts:18:53: 'bar' is declared here. var b12: new >(x: Array, y: T) => Array; a12 = b12; // ok b12 = a12; // ok @@ -193,8 +191,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'. !!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar var b13: new >(x: Array, y: T) => T; a13 = b13; // ok b13 = a13; // ok diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index c5987a93ddf..9f60ca55002 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(14,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -40,8 +38,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts:4:34: 'bar' is declared here. var b2: { [x: number]: Derived2; } a = b2; @@ -49,8 +47,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { class A { diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index f91d0dd0c15..e063a16fd3f 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(14,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -40,8 +38,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts:4:34: 'bar' is declared here. var b2: { [x: number]: Derived2; } a = b2; @@ -49,8 +47,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { interface A { diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt index 61f9e082a48..845edafd82c 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(14,1): error TS2322: Type '{ [x: number]: Base; }' is not assignable to type 'A'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(23,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. - Type 'Derived' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Derived'. + Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(33,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -29,8 +27,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type '{ [x: number]: Base; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts:4:34: 'bar' is declared here. b = a; // ok class B2 extends A { @@ -43,8 +41,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts:5:38: 'baz' is declared here. module Generics { class A { diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt index 0fdae0b7cfa..5f53c581c79 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(24,5): error TS2322: Type 'T' is not assignable to type 'S'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Derived2'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(25,5): error TS2322: Type 'S' is not assignable to type 'T'. Types of property 'foo' are incompatible. - Type 'Derived' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Derived'. + Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(29,5): error TS2322: Type 'T2' is not assignable to type 'S2'. Types of property 'foo' are incompatible. Type 'Derived2' is not assignable to type 'Derived'. @@ -41,8 +39,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'Derived2' is not assignable to type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(70,5): error TS2322: Type 'S' is not assignable to type 'T'. Types of property 'foo' are incompatible. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Property 'baz' is missing in type 'Base' but required in type 'Derived2'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(75,5): error TS2322: Type 'S2' is not assignable to type 'T2'. Types of property 'foo' are incompatible. Type 'Base' is not assignable to type 'Derived2'. @@ -82,14 +79,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'T' is not assignable to type 'S'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Derived2'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. t = s; // error ~ !!! error TS2322: Type 'S' is not assignable to type 'T'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Derived'. +!!! error TS2322: Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts:6:35: 'baz' is declared here. s = s2; // ok s = a2; // ok @@ -182,8 +179,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'S' is not assignable to type 'T'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Property 'baz' is missing in type 'Base' but required in type 'Derived2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts:51:35: 'baz' is declared here. s = s2; // ok s = a2; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt index f9f7e48c685..ce025fde179 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers5.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(13,1): error TS2322: Type 'I' is not assignable to type 'C'. - Property 'foo' is missing in type 'I'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(14,1): error TS2322: Type 'C' is not assignable to type 'I'. - Property 'fooo' is missing in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(13,1): error TS2741: Property 'foo' is missing in type 'I' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts(14,1): error TS2741: Property 'fooo' is missing in type 'C' but required in type 'I'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts (2 errors) ==== @@ -19,9 +17,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme c = i; // error ~ -!!! error TS2322: Type 'I' is not assignable to type 'C'. -!!! error TS2322: Property 'foo' is missing in type 'I'. +!!! error TS2741: Property 'foo' is missing in type 'I' but required in type 'C'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts:2:5: 'foo' is declared here. i = c; // error ~ -!!! error TS2322: Type 'C' is not assignable to type 'I'. -!!! error TS2322: Property 'fooo' is missing in type 'C'. \ No newline at end of file +!!! error TS2741: Property 'fooo' is missing in type 'C' but required in type 'I'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers5.ts:8:5: 'fooo' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt index 0d7fe1071e9..4121337fdad 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.errors.txt @@ -7,24 +7,15 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(39,5): error TS2559: Type 'D' has no properties in common with type '{ opt?: Base; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(40,5): error TS2559: Type 'E' has no properties in common with type '{ opt?: Base; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(41,5): error TS2559: Type 'F' has no properties in common with type '{ opt?: Base; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(74,5): error TS2322: Type 'D' is not assignable to type 'C'. - Property 'opt' is missing in type 'D'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(75,5): error TS2322: Type 'E' is not assignable to type 'C'. - Property 'opt' is missing in type 'E'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(76,5): error TS2322: Type 'F' is not assignable to type 'C'. - Property 'opt' is missing in type 'F'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(79,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'D'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(80,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'E'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(81,5): error TS2322: Type 'F' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'F'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(84,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'D'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(85,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'E'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2322: Type 'F' is not assignable to type '{ opt: Base; }'. - Property 'opt' is missing in type 'F'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(74,5): error TS2741: Property 'opt' is missing in type 'D' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(75,5): error TS2741: Property 'opt' is missing in type 'E' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(76,5): error TS2741: Property 'opt' is missing in type 'F' but required in type 'C'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(79,5): error TS2741: Property 'opt' is missing in type 'D' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(80,5): error TS2741: Property 'opt' is missing in type 'E' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(81,5): error TS2741: Property 'opt' is missing in type 'F' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(84,5): error TS2741: Property 'opt' is missing in type 'D' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(85,5): error TS2741: Property 'opt' is missing in type 'E' but required in type '{ opt: Base; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts(86,5): error TS2741: Property 'opt' is missing in type 'F' but required in type '{ opt: Base; }'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts (18 errors) ==== @@ -121,44 +112,44 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme c = d; // error ~ -!!! error TS2322: Type 'D' is not assignable to type 'C'. -!!! error TS2322: Property 'opt' is missing in type 'D'. +!!! error TS2741: Property 'opt' is missing in type 'D' but required in type 'C'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:53:9: 'opt' is declared here. c = e; // error ~ -!!! error TS2322: Type 'E' is not assignable to type 'C'. -!!! error TS2322: Property 'opt' is missing in type 'E'. +!!! error TS2741: Property 'opt' is missing in type 'E' but required in type 'C'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:53:9: 'opt' is declared here. c = f; // error ~ -!!! error TS2322: Type 'F' is not assignable to type 'C'. -!!! error TS2322: Property 'opt' is missing in type 'F'. +!!! error TS2741: Property 'opt' is missing in type 'F' but required in type 'C'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:53:9: 'opt' is declared here. c = a; // ok a = d; // error ~ -!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'D'. +!!! error TS2741: Property 'opt' is missing in type 'D' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:57:14: 'opt' is declared here. a = e; // error ~ -!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'E'. +!!! error TS2741: Property 'opt' is missing in type 'E' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:57:14: 'opt' is declared here. a = f; // error ~ -!!! error TS2322: Type 'F' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'F'. +!!! error TS2741: Property 'opt' is missing in type 'F' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:57:14: 'opt' is declared here. a = c; // ok b = d; // error ~ -!!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'D'. +!!! error TS2741: Property 'opt' is missing in type 'D' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:58:15: 'opt' is declared here. b = e; // error ~ -!!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'E'. +!!! error TS2741: Property 'opt' is missing in type 'E' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:58:15: 'opt' is declared here. b = f; // error ~ -!!! error TS2322: Type 'F' is not assignable to type '{ opt: Base; }'. -!!! error TS2322: Property 'opt' is missing in type 'F'. +!!! error TS2741: Property 'opt' is missing in type 'F' but required in type '{ opt: Base; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality2.ts:58:15: 'opt' is declared here. b = a; // ok b = c; // ok } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt index d86c73f5cf8..b9cfa3c6b2b 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersStringNumericNames.errors.txt @@ -1,61 +1,32 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(21,5): error TS2322: Type 'T' is not assignable to type 'S'. - Property ''1'' is missing in type 'T'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(22,5): error TS2322: Type 'S' is not assignable to type 'T'. - Property ''1.'' is missing in type 'S'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(24,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S'. - Property ''1'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(26,5): error TS2322: Type 'T2' is not assignable to type 'S2'. - Property ''1'' is missing in type 'T2'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(27,5): error TS2322: Type 'S2' is not assignable to type 'T2'. - Property ''1.0'' is missing in type 'S2'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(28,5): error TS2322: Type 'T' is not assignable to type 'S2'. - Property ''1'' is missing in type 'T'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(29,5): error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type 'S2'. - Property ''1'' is missing in type '{ '1.0': string; baz?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(30,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2'. - Property ''1'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(32,5): error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(33,5): error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ '1.0': string; baz?: string; }'. - Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(34,5): error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type 'S'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(35,5): error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type 'S2'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(36,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(38,5): error TS2322: Type '{ '1': string; }' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type '{ '1': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(39,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1': string; }'. - Property ''1'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(42,5): error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type 'T'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(65,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S'. - Property ''1'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(71,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2'. - Property ''1'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(73,5): error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(74,5): error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ 1.0: string; baz?: string; }'. - Property '1.0' is missing in type '{ '1.': string; bar?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(75,5): error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type 'S'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(76,5): error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type 'S2'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(77,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(78,5): error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. - Property ''1.'' is missing in type '{ 1.: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(80,5): error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type '{ 1.: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(81,5): error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ 1.: string; }'. - Property '1.' is missing in type '{ '1.0': string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(82,5): error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(83,5): error TS2322: Type 'T2' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type 'T2'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(84,5): error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }'. - Property ''1.0'' is missing in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(21,5): error TS2741: Property ''1'' is missing in type 'T' but required in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(22,5): error TS2741: Property ''1.'' is missing in type 'S' but required in type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(24,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(26,5): error TS2741: Property ''1'' is missing in type 'T2' but required in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(27,5): error TS2741: Property ''1.0'' is missing in type 'S2' but required in type 'T2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(28,5): error TS2741: Property ''1'' is missing in type 'T' but required in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(29,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; baz?: string; }' but required in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(30,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(32,5): error TS2741: Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(33,5): error TS2741: Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }' but required in type '{ '1.0': string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(34,5): error TS2741: Property ''1.'' is missing in type 'S' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(35,5): error TS2741: Property ''1.'' is missing in type 'S2' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(36,5): error TS2741: Property ''1.'' is missing in type '{ '1.0': string; }' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(38,5): error TS2741: Property ''1.0'' is missing in type '{ '1': string; }' but required in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(39,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type '{ '1': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(42,5): error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(65,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(71,5): error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S2'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(73,5): error TS2741: Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(74,5): error TS2741: Property '1.0' is missing in type '{ '1.': string; bar?: string; }' but required in type '{ 1.0: string; baz?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(75,5): error TS2741: Property ''1.'' is missing in type 'S' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(76,5): error TS2741: Property ''1.'' is missing in type 'S2' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(77,5): error TS2741: Property ''1.'' is missing in type '{ '1.0': string; }' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(78,5): error TS2741: Property ''1.'' is missing in type '{ 1.: string; }' but required in type '{ '1.': string; bar?: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(80,5): error TS2741: Property ''1.0'' is missing in type '{ 1.: string; }' but required in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(81,5): error TS2741: Property '1.' is missing in type '{ '1.0': string; }' but required in type '{ 1.: string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(82,5): error TS2741: Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }' but required in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(83,5): error TS2741: Property ''1.0'' is missing in type 'T2' but required in type '{ '1.0': string; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts(84,5): error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts (29 errors) ==== @@ -81,74 +52,74 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme s = t; ~ -!!! error TS2322: Type 'T' is not assignable to type 'S'. -!!! error TS2322: Property ''1'' is missing in type 'T'. +!!! error TS2741: Property ''1'' is missing in type 'T' but required in type 'S'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:5:15: ''1'' is declared here. t = s; ~ -!!! error TS2322: Type 'S' is not assignable to type 'T'. -!!! error TS2322: Property ''1.'' is missing in type 'S'. +!!! error TS2741: Property ''1.'' is missing in type 'S' but required in type 'T'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:6:15: ''1.'' is declared here. s = s2; // ok s = a2; ~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:5:15: ''1'' is declared here. s2 = t2; ~~ -!!! error TS2322: Type 'T2' is not assignable to type 'S2'. -!!! error TS2322: Property ''1'' is missing in type 'T2'. +!!! error TS2741: Property ''1'' is missing in type 'T2' but required in type 'S2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:10:20: ''1'' is declared here. t2 = s2; ~~ -!!! error TS2322: Type 'S2' is not assignable to type 'T2'. -!!! error TS2322: Property ''1.0'' is missing in type 'S2'. +!!! error TS2741: Property ''1.0'' is missing in type 'S2' but required in type 'T2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:11:20: ''1.0'' is declared here. s2 = t; ~~ -!!! error TS2322: Type 'T' is not assignable to type 'S2'. -!!! error TS2322: Property ''1'' is missing in type 'T'. +!!! error TS2741: Property ''1'' is missing in type 'T' but required in type 'S2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:10:20: ''1'' is declared here. s2 = b; ~~ -!!! error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type 'S2'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; baz?: string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; baz?: string; }' but required in type 'S2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:10:20: ''1'' is declared here. s2 = a2; ~~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:10:20: ''1'' is declared here. a = b; ~ -!!! error TS2322: Type '{ '1.0': string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }'. +!!! error TS2741: Property ''1.'' is missing in type '{ '1.0': string; baz?: string; }' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:15:14: ''1.'' is declared here. b = a; ~ -!!! error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ '1.0': string; baz?: string; }'. -!!! error TS2322: Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }'. +!!! error TS2741: Property ''1.0'' is missing in type '{ '1.': string; bar?: string; }' but required in type '{ '1.0': string; baz?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:16:14: ''1.0'' is declared here. a = s; ~ -!!! error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type 'S'. +!!! error TS2741: Property ''1.'' is missing in type 'S' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:15:14: ''1.'' is declared here. a = s2; ~ -!!! error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type 'S2'. +!!! error TS2741: Property ''1.'' is missing in type 'S2' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:15:14: ''1.'' is declared here. a = a2; ~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1.'' is missing in type '{ '1.0': string; }' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:15:14: ''1.'' is declared here. a2 = b2; ~~ -!!! error TS2322: Type '{ '1': string; }' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type '{ '1': string; }'. +!!! error TS2741: Property ''1.0'' is missing in type '{ '1': string; }' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:18:16: ''1.0'' is declared here. b2 = a2; ~~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1': string; }'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type '{ '1': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:19:16: ''1'' is declared here. a2 = b; // ok a2 = t2; // ok a2 = t; ~~ -!!! error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type 'T'. +!!! error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:18:16: ''1.0'' is declared here. } module NumbersAndStrings { @@ -173,8 +144,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme s = s2; // ok s = a2; // error ~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:46:15: ''1'' is declared here. s2 = t2; // ok t2 = s2; // ok @@ -182,52 +153,52 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme s2 = b; // ok s2 = a2; // error ~~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type 'S2'. -!!! error TS2322: Property ''1'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1'' is missing in type '{ '1.0': string; }' but required in type 'S2'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:51:20: ''1'' is declared here. a = b; // error ~ -!!! error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }'. +!!! error TS2741: Property ''1.'' is missing in type '{ 1.0: string; baz?: string; }' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:56:14: ''1.'' is declared here. b = a; // error ~ -!!! error TS2322: Type '{ '1.': string; bar?: string; }' is not assignable to type '{ 1.0: string; baz?: string; }'. -!!! error TS2322: Property '1.0' is missing in type '{ '1.': string; bar?: string; }'. +!!! error TS2741: Property '1.0' is missing in type '{ '1.': string; bar?: string; }' but required in type '{ 1.0: string; baz?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:57:14: '1.0' is declared here. a = s; // error ~ -!!! error TS2322: Type 'S' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type 'S'. +!!! error TS2741: Property ''1.'' is missing in type 'S' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:56:14: ''1.'' is declared here. a = s2; // error ~ -!!! error TS2322: Type 'S2' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type 'S2'. +!!! error TS2741: Property ''1.'' is missing in type 'S2' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:56:14: ''1.'' is declared here. a = a2; // error ~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property ''1.'' is missing in type '{ '1.0': string; }' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:56:14: ''1.'' is declared here. a = b2; // error ~ -!!! error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.': string; bar?: string; }'. -!!! error TS2322: Property ''1.'' is missing in type '{ 1.: string; }'. +!!! error TS2741: Property ''1.'' is missing in type '{ 1.: string; }' but required in type '{ '1.': string; bar?: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:56:14: ''1.'' is declared here. a2 = b2; // error ~~ -!!! error TS2322: Type '{ 1.: string; }' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type '{ 1.: string; }'. +!!! error TS2741: Property ''1.0'' is missing in type '{ 1.: string; }' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:59:16: ''1.0'' is declared here. b2 = a2; // error ~~ -!!! error TS2322: Type '{ '1.0': string; }' is not assignable to type '{ 1.: string; }'. -!!! error TS2322: Property '1.' is missing in type '{ '1.0': string; }'. +!!! error TS2741: Property '1.' is missing in type '{ '1.0': string; }' but required in type '{ 1.: string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:60:16: '1.' is declared here. a2 = b; // error ~~ -!!! error TS2322: Type '{ 1.0: string; baz?: string; }' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }'. +!!! error TS2741: Property ''1.0'' is missing in type '{ 1.0: string; baz?: string; }' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:59:16: ''1.0'' is declared here. a2 = t2; // error ~~ -!!! error TS2322: Type 'T2' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type 'T2'. +!!! error TS2741: Property ''1.0'' is missing in type 'T2' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:59:16: ''1.0'' is declared here. a2 = t; // error ~~ -!!! error TS2322: Type 'T' is not assignable to type '{ '1.0': string; }'. -!!! error TS2322: Property ''1.0'' is missing in type 'T'. +!!! error TS2741: Property ''1.0'' is missing in type 'T' but required in type '{ '1.0': string; }'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersStringNumericNames.ts:59:16: ''1.0'' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index 51762bb9418..523c6b97337 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(15,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'Base' is not assignable to type 'Derived'. @@ -47,8 +45,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts:4:34: 'bar' is declared here. var b2: { [x: string]: Derived2; } a = b2; // ok @@ -56,8 +54,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { class A { diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index 0b0d70d01bb..180012decc2 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -1,11 +1,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(15,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. - Property 'bar' is missing in type 'Base'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. - Property 'baz' is missing in type 'Base'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'Base' is not assignable to type 'Derived'. @@ -47,8 +45,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. -!!! error TS2322: Property 'bar' is missing in type 'Base'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts:4:34: 'bar' is declared here. var b2: { [x: string]: Derived2; } a = b2; // ok @@ -56,8 +54,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. -!!! error TS2322: Property 'baz' is missing in type 'Base'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar module Generics { interface A { diff --git a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt index e9adcba03b7..cc61e0ebfe4 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt @@ -1,14 +1,12 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Applicable'. -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable'. - Property 'apply' is missing in type 'string[]'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Applicable'. -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable'. - Property 'apply' is missing in type '{}'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'. - Property 'apply' is missing in type '{}'. + Property 'apply' is missing in type '{}' but required in type 'Applicable'. ==== tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts (8 errors) ==== @@ -26,15 +24,15 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi !!! error TS2322: Type '""' is not assignable to type 'Applicable'. x = ['']; ~ -!!! error TS2322: Type 'string[]' is not assignable to type 'Applicable'. -!!! error TS2322: Property 'apply' is missing in type 'string[]'. +!!! error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here. x = 4; ~ !!! error TS2322: Type '4' is not assignable to type 'Applicable'. x = {}; ~ -!!! error TS2322: Type '{}' is not assignable to type 'Applicable'. -!!! error TS2322: Property 'apply' is missing in type '{}'. +!!! error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here. // Should work function f() { }; @@ -55,7 +53,8 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi fn({}); ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'. -!!! error TS2345: Property 'apply' is missing in type '{}'. +!!! error TS2345: Property 'apply' is missing in type '{}' but required in type 'Applicable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here. // Should work diff --git a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt index 17556302178..d1894692635 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt @@ -1,14 +1,12 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Callable'. -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Callable'. - Property 'call' is missing in type 'string[]'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Callable'. -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Callable'. - Property 'call' is missing in type '{}'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. - Property 'call' is missing in type '{}'. + Property 'call' is missing in type '{}' but required in type 'Callable'. ==== tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts (8 errors) ==== @@ -26,15 +24,15 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio !!! error TS2322: Type '""' is not assignable to type 'Callable'. x = ['']; ~ -!!! error TS2322: Type 'string[]' is not assignable to type 'Callable'. -!!! error TS2322: Property 'call' is missing in type 'string[]'. +!!! error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here. x = 4; ~ !!! error TS2322: Type '4' is not assignable to type 'Callable'. x = {}; ~ -!!! error TS2322: Type '{}' is not assignable to type 'Callable'. -!!! error TS2322: Property 'call' is missing in type '{}'. +!!! error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here. // Should work function f() { }; @@ -55,7 +53,8 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio fn({}); ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. -!!! error TS2345: Property 'call' is missing in type '{}'. +!!! error TS2345: Property 'call' is missing in type '{}' but required in type 'Callable'. +!!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here. // Should work diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt index 9e28f5e9177..897c96a1c8f 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt +++ b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt @@ -1,6 +1,5 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(1,24): error TS2322: Type 'number' is not assignable to type '() => string'. -tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '{}' is not assignable to type 'Function'. - Property 'apply' is missing in type '{}'. +tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2740: Type '{}' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'. Types of property 'apply' are incompatible. Type 'number' is not assignable to type '(this: Function, thisArg: any, argArray?: any) => any'. @@ -18,8 +17,7 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type var errFun: Function = {}; // Error for no call signature ~~~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'Function'. -!!! error TS2322: Property 'apply' is missing in type '{}'. +!!! error TS2740: Type '{}' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. function foo() { } module foo { diff --git a/tests/baselines/reference/bases.errors.txt b/tests/baselines/reference/bases.errors.txt index 3069f977fe1..fb63428b876 100644 --- a/tests/baselines/reference/bases.errors.txt +++ b/tests/baselines/reference/bases.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/bases.ts(7,14): error TS2339: Property 'y' does not exist o tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(7,17): error TS2693: 'any' only refers to a type, but is being used as a value here. tests/cases/compiler/bases.ts(11,7): error TS2420: Class 'C' incorrectly implements interface 'I'. - Property 'x' is missing in type 'C'. + Property 'x' is missing in type 'C' but required in type 'I'. tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/bases.ts(13,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'. @@ -32,7 +32,8 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o class C extends B implements I { ~ !!! error TS2420: Class 'C' incorrectly implements interface 'I'. -!!! error TS2420: Property 'x' is missing in type 'C'. +!!! error TS2420: Property 'x' is missing in type 'C' but required in type 'I'. +!!! related TS2728 tests/cases/compiler/bases.ts:2:5: 'x' is declared here. constructor() { ~~~~~~~~~~~~~~~ this.x: any; diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 18267e6ffdf..3f2f7b39112 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/bigintWithLib.ts(16,33): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. - Type 'number[]' is not assignable to type 'SharedArrayBuffer'. - Property 'byteLength' is missing in type 'number[]'. + Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a constant or a read-only property. tests/cases/compiler/bigintWithLib.ts(28,35): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. Type 'number[]' is not assignable to type 'SharedArrayBuffer'. @@ -31,8 +30,7 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 bigIntArray = new BigInt64Array([1, 2, 3]); // should error ~~~~~~~~~ !!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. -!!! error TS2345: Type 'number[]' is not assignable to type 'SharedArrayBuffer'. -!!! error TS2345: Property 'byteLength' is missing in type 'number[]'. +!!! error TS2345: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] bigIntArray = new BigInt64Array(new ArrayBuffer(80)); bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); diff --git a/tests/baselines/reference/bluebirdStaticThis.errors.txt b/tests/baselines/reference/bluebirdStaticThis.errors.txt index b9e28711715..257cc1bb823 100644 --- a/tests/baselines/reference/bluebirdStaticThis.errors.txt +++ b/tests/baselines/reference/bluebirdStaticThis.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/bluebirdStaticThis.ts(5,22): error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. - Property 'then' is missing in type 'Promise'. + Property 'then' is missing in type 'Promise' but required in type 'Thenable'. tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Resolver'. tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'. tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'. @@ -15,7 +15,8 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"tes export declare class Promise implements Promise.Thenable { ~~~~~~~ !!! error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. -!!! error TS2420: Property 'then' is missing in type 'Promise'. +!!! error TS2420: Property 'then' is missing in type 'Promise' but required in type 'Thenable'. +!!! related TS2728 tests/cases/compiler/bluebirdStaticThis.ts:113:3: 'then' is declared here. constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 08e2b32a858..4587612cb76 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -1,17 +1,16 @@ tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2352: Conversion of type '[number, string]' to type '[number, string, boolean]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - Property '2' is missing in type '[number, string]'. + Property '2' is missing in type '[number, string]' but required in type '[number, string, boolean]'. tests/cases/conformance/types/tuple/castingTuple.ts(14,15): error TS2352: Conversion of type '[number, string, boolean]' to type '[number, string]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Types of property 'length' are incompatible. Type '3' is not comparable to type '2'. tests/cases/conformance/types/tuple/castingTuple.ts(15,14): error TS2352: Conversion of type '[number, string]' to type '[number, string, boolean]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. tests/cases/conformance/types/tuple/castingTuple.ts(18,21): error TS2352: Conversion of type '[C, D]' to type '[C, D, A]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - Property '2' is missing in type '[C, D]'. + Property '2' is missing in type '[C, D]' but required in type '[C, D, A]'. tests/cases/conformance/types/tuple/castingTuple.ts(20,33): error TS2339: Property '5' does not exist on type '[C, D, A]'. tests/cases/conformance/types/tuple/castingTuple.ts(30,10): error TS2352: Conversion of type '[number, string]' to type '[number, number]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Type 'string' is not comparable to type 'number'. tests/cases/conformance/types/tuple/castingTuple.ts(31,10): error TS2352: Conversion of type '[C, D]' to type '[A, I]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - Type 'C' is not comparable to type 'A'. - Property 'a' is missing in type 'C'. + Property 'a' is missing in type 'C' but required in type 'A'. tests/cases/conformance/types/tuple/castingTuple.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot find name 't4'. @@ -32,7 +31,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot var numStrBoolTuple = <[number, string, boolean]>numStrTuple; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type '[number, string]' to type '[number, string, boolean]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -!!! error TS2352: Property '2' is missing in type '[number, string]'. +!!! error TS2352: Property '2' is missing in type '[number, string]' but required in type '[number, string, boolean]'. var shorter = numStrBoolTuple as [number, string] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type '[number, string, boolean]' to type '[number, string]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. @@ -46,7 +45,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot var classCDATuple = <[C, D, A]>classCDTuple; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type '[C, D]' to type '[C, D, A]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -!!! error TS2352: Property '2' is missing in type '[C, D]'. +!!! error TS2352: Property '2' is missing in type '[C, D]' but required in type '[C, D, A]'. var eleFromCDA1 = classCDATuple[2]; // A var eleFromCDA2 = classCDATuple[5]; // C | D | A ~ @@ -67,8 +66,8 @@ tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot var t9 = <[A, I]>classCDTuple; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type '[C, D]' to type '[A, I]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -!!! error TS2352: Type 'C' is not comparable to type 'A'. -!!! error TS2352: Property 'a' is missing in type 'C'. +!!! error TS2352: Property 'a' is missing in type 'C' but required in type 'A'. +!!! related TS2728 tests/cases/conformance/types/tuple/castingTuple.ts:2:11: 'a' is declared here. var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. diff --git a/tests/baselines/reference/chainedAssignment1.errors.txt b/tests/baselines/reference/chainedAssignment1.errors.txt index 3fa654c62cc..32ae0f63dc7 100644 --- a/tests/baselines/reference/chainedAssignment1.errors.txt +++ b/tests/baselines/reference/chainedAssignment1.errors.txt @@ -1,7 +1,5 @@ -tests/cases/compiler/chainedAssignment1.ts(21,1): error TS2322: Type 'Z' is not assignable to type 'X'. - Property 'a' is missing in type 'Z'. -tests/cases/compiler/chainedAssignment1.ts(21,6): error TS2322: Type 'Z' is not assignable to type 'Y'. - Property 'a' is missing in type 'Z'. +tests/cases/compiler/chainedAssignment1.ts(21,1): error TS2741: Property 'a' is missing in type 'Z' but required in type 'X'. +tests/cases/compiler/chainedAssignment1.ts(21,6): error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b tests/cases/compiler/chainedAssignment1.ts(22,1): error TS2322: Type 'Z' is not assignable to type 'Y'. @@ -28,11 +26,10 @@ tests/cases/compiler/chainedAssignment1.ts(22,1): error TS2322: Type 'Z' is not var c3 = new Z(); c1 = c2 = c3; // a bug made this not report the same error as below ~~ -!!! error TS2322: Type 'Z' is not assignable to type 'X'. -!!! error TS2322: Property 'a' is missing in type 'Z'. +!!! error TS2741: Property 'a' is missing in type 'Z' but required in type 'X'. +!!! related TS2728 tests/cases/compiler/chainedAssignment1.ts:3:5: 'a' is declared here. ~~ -!!! error TS2322: Type 'Z' is not assignable to type 'Y'. -!!! error TS2322: Property 'a' is missing in type 'Z'. +!!! error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b c2 = c3; // Error TS111: Cannot convert Z to Y ~~ !!! error TS2322: Type 'Z' is not assignable to type 'Y'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignment3.errors.txt b/tests/baselines/reference/chainedAssignment3.errors.txt index 8a64a35cbc0..16f6b2fe652 100644 --- a/tests/baselines/reference/chainedAssignment3.errors.txt +++ b/tests/baselines/reference/chainedAssignment3.errors.txt @@ -1,5 +1,4 @@ -tests/cases/compiler/chainedAssignment3.ts(18,1): error TS2322: Type 'A' is not assignable to type 'B'. - Property 'value' is missing in type 'A'. +tests/cases/compiler/chainedAssignment3.ts(18,1): error TS2741: Property 'value' is missing in type 'A' but required in type 'B'. tests/cases/compiler/chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not assignable to type 'B'. @@ -23,8 +22,8 @@ tests/cases/compiler/chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not // error cases b = a = new A(); ~ -!!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: Property 'value' is missing in type 'A'. +!!! error TS2741: Property 'value' is missing in type 'A' but required in type 'B'. +!!! related TS2728 tests/cases/compiler/chainedAssignment3.ts:6:5: 'value' is declared here. a = b = new A(); ~ !!! error TS2322: Type 'A' is not assignable to type 'B'. diff --git a/tests/baselines/reference/chainedAssignmentChecking.errors.txt b/tests/baselines/reference/chainedAssignmentChecking.errors.txt index ac3bade0aae..567a599b63e 100644 --- a/tests/baselines/reference/chainedAssignmentChecking.errors.txt +++ b/tests/baselines/reference/chainedAssignmentChecking.errors.txt @@ -1,7 +1,5 @@ -tests/cases/compiler/chainedAssignmentChecking.ts(21,1): error TS2322: Type 'Z' is not assignable to type 'X'. - Property 'a' is missing in type 'Z'. -tests/cases/compiler/chainedAssignmentChecking.ts(21,6): error TS2322: Type 'Z' is not assignable to type 'Y'. - Property 'a' is missing in type 'Z'. +tests/cases/compiler/chainedAssignmentChecking.ts(21,1): error TS2741: Property 'a' is missing in type 'Z' but required in type 'X'. +tests/cases/compiler/chainedAssignmentChecking.ts(21,6): error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b ==== tests/cases/compiler/chainedAssignmentChecking.ts (2 errors) ==== @@ -27,9 +25,8 @@ tests/cases/compiler/chainedAssignmentChecking.ts(21,6): error TS2322: Type 'Z' c1 = c2 = c3; // Should be error ~~ -!!! error TS2322: Type 'Z' is not assignable to type 'X'. -!!! error TS2322: Property 'a' is missing in type 'Z'. +!!! error TS2741: Property 'a' is missing in type 'Z' but required in type 'X'. +!!! related TS2728 tests/cases/compiler/chainedAssignmentChecking.ts:3:3: 'a' is declared here. ~~ -!!! error TS2322: Type 'Z' is not assignable to type 'Y'. -!!! error TS2322: Property 'a' is missing in type 'Z'. +!!! error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt index cee9236d630..2e39f19d86a 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt @@ -1,5 +1,4 @@ -tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2322: Type 'B' is not assignable to type 'C'. - Property 'z' is missing in type 'B'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'. ==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ==== @@ -23,6 +22,6 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete // Ok to go down the chain, but error to try to climb back up (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); ~~~~~ -!!! error TS2322: Type 'B' is not assignable to type 'C'. -!!! error TS2322: Property 'z' is missing in type 'B'. +!!! error TS2741: Property 'z' is missing in type 'B' but required in type 'C'. +!!! related TS2728 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here. !!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt index cc86b6115af..bbc2e8cd6b1 100644 --- a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt @@ -1,6 +1,5 @@ tests/cases/conformance/jsdoc/test.js(1,5): error TS8030: The type of a function declaration must match the function's signature. -tests/cases/conformance/jsdoc/test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. - Property 'prop' is missing in type '(prop: any) => void'. +tests/cases/conformance/jsdoc/test.js(7,5): error TS2741: Property 'prop' is missing in type '(prop: any) => void' but required in type '{ prop: string; }'. tests/cases/conformance/jsdoc/test.js(10,5): error TS8030: The type of a function declaration must match the function's signature. @@ -15,8 +14,8 @@ tests/cases/conformance/jsdoc/test.js(10,5): error TS8030: The type of a functio /** @type {{ prop: string }} */ var g = function (prop) { ~ -!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'. -!!! error TS2322: Property 'prop' is missing in type '(prop: any) => void'. +!!! error TS2741: Property 'prop' is missing in type '(prop: any) => void' but required in type '{ prop: string; }'. +!!! related TS2728 tests/cases/conformance/jsdoc/test.js:6:14: 'prop' is declared here. } /** @type {(a: number) => number} */ diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt index 6878372be8b..b401345a5e1 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt @@ -1,8 +1,6 @@ -tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'. - Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'SingleChildProp'. - Types of property 'children' are incompatible. - Type 'Element[]' is not assignable to type 'Element'. - Property 'type' is missing in type 'Element[]'. +tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Element[]; a: number; b: string; }' is not assignable to type 'SingleChildProp'. + Types of property 'children' are incompatible. + Type 'Element[]' is missing the following properties from type 'Element': type, props ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -49,8 +47,6 @@ tests/cases/conformance/jsx/file.tsx(42,11): error TS2322: Type '{ children: Ele // Error let k5 = <>