From b467cd8a99cb54c5302c2ddb144d1068fe6f2c31 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 3 May 2018 10:55:44 -0700 Subject: [PATCH] Move property errors to the name for the error span (#23865) --- src/compiler/utilities.ts | 2 + ...validConstOnPropertyDeclaration.errors.txt | 4 +- .../circularIndexedAccessErrors.errors.txt | 8 +- .../reference/classIndexer2.errors.txt | 2 +- .../reference/classIndexer3.errors.txt | 2 +- .../reference/classIndexer4.errors.txt | 2 +- .../classPropertyErrorOnNameOnly.errors.txt | 55 +++++++++++ .../reference/classPropertyErrorOnNameOnly.js | 78 +++++++++++++++ .../classPropertyErrorOnNameOnly.symbols | 57 +++++++++++ .../classPropertyErrorOnNameOnly.types | 99 +++++++++++++++++++ .../computedPropertyNames42_ES5.errors.txt | 2 +- .../computedPropertyNames42_ES6.errors.txt | 2 +- .../reference/contextualTyping11.errors.txt | 4 +- .../reference/contextualTyping5.errors.txt | 4 +- ...faceIncompatibleWithBaseIndexer.errors.txt | 12 +-- ...sNotASubtypeOfAnythingButNumber.errors.txt | 32 +++--- ...nAndInterfaceWithSeparateErrors.errors.txt | 2 +- .../implicitAnyCastedValue.errors.txt | 6 +- ...icitAnyDeclareMemberWithoutType.errors.txt | 2 +- ...citAnyDeclareMemberWithoutType2.errors.txt | 4 +- ...yDeclareTypePropertyWithoutType.errors.txt | 6 +- ...tionInvocationWithAnyArguements.errors.txt | 4 +- ...AndSetAccessorWithAnyReturnType.errors.txt | 2 +- ...implicitAnyInAmbientDeclaration.errors.txt | 4 +- ...licitAnyInAmbientDeclaration2.d.errors.txt | 4 +- .../interfaceExtendingClass2.errors.txt | 5 +- ...ingIndexerHidingBaseTypeIndexer.errors.txt | 8 +- ...ngIndexerHidingBaseTypeIndexer2.errors.txt | 8 +- ...ngIndexerHidingBaseTypeIndexer3.errors.txt | 8 +- .../interfacedeclWithIndexerErrors.errors.txt | 6 +- .../limitDeepInstantiations.errors.txt | 2 +- .../mergedInterfacesWithIndexers2.errors.txt | 4 +- .../noImplicitAnyWithOverloads.errors.txt | 2 +- ...rConstrainsPropertyDeclarations.errors.txt | 8 +- ...ConstrainsPropertyDeclarations2.errors.txt | 6 +- .../numericIndexerConstraint.errors.txt | 2 +- .../reference/objectRestNegative.errors.txt | 2 +- ...rivacyCannotNameVarTypeDeclFile.errors.txt | 24 ++--- .../propertiesAndIndexers.errors.txt | 20 ++-- .../propertiesAndIndexers2.errors.txt | 12 +-- ...rtiesAndIndexersForNumericNames.errors.txt | 32 +++--- .../stringIndexerAndConstructor.errors.txt | 4 +- .../stringIndexerAndConstructor1.errors.txt | 2 +- ...rConstrainsPropertyDeclarations.errors.txt | 36 +++---- ...ConstrainsPropertyDeclarations2.errors.txt | 12 +-- ...sOfTypeParameterWithConstraints.errors.txt | 60 +++++------ ...OfTypeParameterWithConstraints4.errors.txt | 30 +++--- ...rameterWithRecursiveConstraints.errors.txt | 64 ++++++------ .../reference/subtypesOfUnion.errors.txt | 58 +++++------ .../baselines/reference/typeName1.errors.txt | 4 +- ...IfEveryConstituentTypeIsSubtype.errors.txt | 60 +++++------ .../compiler/classPropertyErrorOnNameOnly.ts | 39 ++++++++ 52 files changed, 620 insertions(+), 297 deletions(-) create mode 100644 tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt create mode 100644 tests/baselines/reference/classPropertyErrorOnNameOnly.js create mode 100644 tests/baselines/reference/classPropertyErrorOnNameOnly.symbols create mode 100644 tests/baselines/reference/classPropertyErrorOnNameOnly.types create mode 100644 tests/cases/compiler/classPropertyErrorOnNameOnly.ts diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 04db855d4f8..43777f6c453 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -688,6 +688,8 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: errorNode = (node).name; break; case SyntaxKind.ArrowFunction: diff --git a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt index d07f07e2096..5091937bde2 100644 --- a/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt +++ b/tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts(2,3): error TS1248: A class member cannot have the 'const' keyword. +tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts(2,16): error TS1248: A class member cannot have the 'const' keyword. ==== tests/cases/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.ts (1 errors) ==== class AtomicNumbers { static const H = 1; - ~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS1248: A class member cannot have the 'const' keyword. } \ No newline at end of file diff --git a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt index d2e9171065b..f2bf858ab9e 100644 --- a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt @@ -9,13 +9,13 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(37,30): error ==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (6 errors) ==== type T1 = { x: T1["x"]; // Error - ~~~~~~~~~~~ + ~ !!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. }; type T2 = { x: T2[K]; // Error - ~~~~~~~~~~~~ + ~ !!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. y: number; } @@ -29,13 +29,13 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(37,30): error interface T4> { x: T4["x"]; // Error - ~~~~~~~~~~~~~~ + ~ !!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. } class C1 { x: C1["x"]; // Error - ~~~~~~~~~~~ + ~ !!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. } diff --git a/tests/baselines/reference/classIndexer2.errors.txt b/tests/baselines/reference/classIndexer2.errors.txt index 82629584ee5..c916ca27846 100644 --- a/tests/baselines/reference/classIndexer2.errors.txt +++ b/tests/baselines/reference/classIndexer2.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/classIndexer2.ts(4,5): error TS2411: Property 'y' of type ' [s: string]: number; x: number; y: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. constructor() { } diff --git a/tests/baselines/reference/classIndexer3.errors.txt b/tests/baselines/reference/classIndexer3.errors.txt index eb7a2467fba..fbd4b35327f 100644 --- a/tests/baselines/reference/classIndexer3.errors.txt +++ b/tests/baselines/reference/classIndexer3.errors.txt @@ -11,6 +11,6 @@ tests/cases/compiler/classIndexer3.ts(9,5): error TS2411: Property 'y' of type ' class D123 extends C123 { x: number; y: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classIndexer4.errors.txt b/tests/baselines/reference/classIndexer4.errors.txt index f5a132b3dc2..5375f9610d7 100644 --- a/tests/baselines/reference/classIndexer4.errors.txt +++ b/tests/baselines/reference/classIndexer4.errors.txt @@ -11,6 +11,6 @@ tests/cases/compiler/classIndexer4.ts(9,5): error TS2411: Property 'y' of type ' interface D123 extends C123 { x: number; y: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'y' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt new file mode 100644 index 00000000000..7ef791997dd --- /dev/null +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. + Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. +tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. + Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. + + +==== tests/cases/compiler/classPropertyErrorOnNameOnly.ts (2 errors) ==== + type Values = 1 | 2 | 3 | 4 | 5 | 6 + + type FuncType = (arg: Values) => string + + // turn on strictNullChecks + class Example { + insideClass: FuncType = function(val) { // error span goes from here + ~~~~~~~~~~~ +!!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. +!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } + } // all the way to here + } + + const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case + ~~~~~~~~~~~~ +!!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. +!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } + } \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.js b/tests/baselines/reference/classPropertyErrorOnNameOnly.js new file mode 100644 index 00000000000..44587702079 --- /dev/null +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.js @@ -0,0 +1,78 @@ +//// [classPropertyErrorOnNameOnly.ts] +type Values = 1 | 2 | 3 | 4 | 5 | 6 + +type FuncType = (arg: Values) => string + +// turn on strictNullChecks +class Example { + insideClass: FuncType = function(val) { // error span goes from here + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } + } // all the way to here +} + +const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } +} + +//// [classPropertyErrorOnNameOnly.js] +"use strict"; +// turn on strictNullChecks +var Example = /** @class */ (function () { + function Example() { + this.insideClass = function (val) { + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3"; + case 4: + return "4"; + case 5: + return "5"; + // forgot case 6 + } + }; // all the way to here + } + return Example; +}()); +var outsideClass = function (val) { + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3"; + case 4: + return "4"; + case 5: + return "5"; + // forgot case 6 + } +}; diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.symbols b/tests/baselines/reference/classPropertyErrorOnNameOnly.symbols new file mode 100644 index 00000000000..d3064bed3dc --- /dev/null +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.symbols @@ -0,0 +1,57 @@ +=== tests/cases/compiler/classPropertyErrorOnNameOnly.ts === +type Values = 1 | 2 | 3 | 4 | 5 | 6 +>Values : Symbol(Values, Decl(classPropertyErrorOnNameOnly.ts, 0, 0)) + +type FuncType = (arg: Values) => string +>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35)) +>arg : Symbol(arg, Decl(classPropertyErrorOnNameOnly.ts, 2, 17)) +>Values : Symbol(Values, Decl(classPropertyErrorOnNameOnly.ts, 0, 0)) + +// turn on strictNullChecks +class Example { +>Example : Symbol(Example, Decl(classPropertyErrorOnNameOnly.ts, 2, 39)) + + insideClass: FuncType = function(val) { // error span goes from here +>insideClass : Symbol(Example.insideClass, Decl(classPropertyErrorOnNameOnly.ts, 5, 15)) +>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35)) +>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 6, 35)) + + switch (val) { +>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 6, 35)) + + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } + } // all the way to here +} + +const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case +>outsideClass : Symbol(outsideClass, Decl(classPropertyErrorOnNameOnly.ts, 23, 5)) +>FuncType : Symbol(FuncType, Decl(classPropertyErrorOnNameOnly.ts, 0, 35)) +>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 23, 40)) + + switch (val) { +>val : Symbol(val, Decl(classPropertyErrorOnNameOnly.ts, 23, 40)) + + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } +} diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.types b/tests/baselines/reference/classPropertyErrorOnNameOnly.types new file mode 100644 index 00000000000..372d489df29 --- /dev/null +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.types @@ -0,0 +1,99 @@ +=== tests/cases/compiler/classPropertyErrorOnNameOnly.ts === +type Values = 1 | 2 | 3 | 4 | 5 | 6 +>Values : Values + +type FuncType = (arg: Values) => string +>FuncType : FuncType +>arg : Values +>Values : Values + +// turn on strictNullChecks +class Example { +>Example : Example + + insideClass: FuncType = function(val) { // error span goes from here +>insideClass : FuncType +>FuncType : FuncType +>function(val) { // error span goes from here switch (val) { case 1: return "1"; case 2: return "2"; case 3: return "3" case 4: return "4" case 5: return "5" // forgot case 6 } } : (val: Values) => "1" | "2" | "3" | "4" | "5" | undefined +>val : Values + + switch (val) { +>val : Values + + case 1: +>1 : 1 + + return "1"; +>"1" : "1" + + case 2: +>2 : 2 + + return "2"; +>"2" : "2" + + case 3: +>3 : 3 + + return "3" +>"3" : "3" + + case 4: +>4 : 4 + + return "4" +>"4" : "4" + + case 5: +>5 : 5 + + return "5" +>"5" : "5" + + // forgot case 6 + } + } // all the way to here +} + +const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case +>outsideClass : FuncType +>FuncType : FuncType +>function(val) { // compare to errors only on this line in this case switch (val) { case 1: return "1"; case 2: return "2"; case 3: return "3" case 4: return "4" case 5: return "5" // forgot case 6 }} : (val: Values) => "1" | "2" | "3" | "4" | "5" | undefined +>val : Values + + switch (val) { +>val : Values + + case 1: +>1 : 1 + + return "1"; +>"1" : "1" + + case 2: +>2 : 2 + + return "2"; +>"2" : "2" + + case 3: +>3 : 3 + + return "3" +>"3" : "3" + + case 4: +>4 : 4 + + return "4" +>"4" : "4" + + case 5: +>5 : 5 + + return "5" +>"5" : "5" + + // forgot case 6 + } +} diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt index bdb978220a0..0eeff51837e 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -10,6 +10,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8, // Computed properties [""]: Foo; - ~~~~~~~~~~ + ~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt index 9feb6ba3d32..3dcd6e898ed 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -10,6 +10,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8, // Computed properties [""]: Foo; - ~~~~~~~~~~ + ~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping11.errors.txt b/tests/baselines/reference/contextualTyping11.errors.txt index a7879725814..0b7cf231c12 100644 --- a/tests/baselines/reference/contextualTyping11.errors.txt +++ b/tests/baselines/reference/contextualTyping11.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping11.ts(1,13): error TS2322: Type 'foo[]' is not assignable to type '{ id: number; }[]'. +tests/cases/compiler/contextualTyping11.ts(1,20): error TS2322: Type 'foo[]' is not assignable to type '{ id: number; }[]'. Type 'foo' is not assignable to type '{ id: number; }'. Property 'id' is missing in type 'foo'. ==== tests/cases/compiler/contextualTyping11.ts (1 errors) ==== class foo { public bar:{id:number;}[] = [({})]; } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type 'foo[]' is not assignable to type '{ id: number; }[]'. !!! error TS2322: Type 'foo' is not assignable to type '{ id: number; }'. !!! error TS2322: Property 'id' is missing in type 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping5.errors.txt b/tests/baselines/reference/contextualTyping5.errors.txt index 5105f67190c..2d8e01836ec 100644 --- a/tests/baselines/reference/contextualTyping5.errors.txt +++ b/tests/baselines/reference/contextualTyping5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/contextualTyping5.ts(1,13): error TS2322: Type '{}' is not assignable to type '{ id: number; }'. +tests/cases/compiler/contextualTyping5.ts(1,20): error TS2322: Type '{}' is not assignable to type '{ id: number; }'. Property 'id' is missing in type '{}'. ==== tests/cases/compiler/contextualTyping5.ts (1 errors) ==== class foo { public bar:{id:number;} = { }; } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2322: Type '{}' is not assignable to type '{ id: number; }'. !!! error TS2322: Property 'id' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt index e23384268b1..904a6f5fe34 100644 --- a/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt +++ b/tests/baselines/reference/derivedInterfaceIncompatibleWithBaseIndexer.errors.txt @@ -15,23 +15,23 @@ tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompa interface Derived extends Base { 1: { y: number } // error - ~~~~~~~~~~~~~~~~ + ~ !!! error TS2411: Property '1' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. - ~~~~~~~~~~~~~~~~ + ~ !!! error TS2412: Property '1' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived2 extends Base { '1': { y: number } // error - ~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property ''1'' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. - ~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property ''1'' of type '{ y: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } interface Derived3 extends Base { foo: { y: number } // error - ~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type '{ y: number; }' is not assignable to string index type '{ x: number; }'. } @@ -44,7 +44,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/derivedInterfaceIncompa // satisifies string indexer but not numeric indexer interface Derived5 extends Base { 1: { x: number } // error - ~~~~~~~~~~~~~~~~ + ~ !!! error TS2412: Property '1' of type '{ x: number; }' is not assignable to numeric index type '{ x: number; y: number; }'. } diff --git a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt index 1f8def801cc..225c0d811bc 100644 --- a/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt +++ b/tests/baselines/reference/enumIsNotASubtypeOfAnythingButNumber.errors.txt @@ -35,7 +35,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I3 { [x: string]: string; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'string'. } @@ -43,7 +43,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I4 { [x: string]: boolean; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'boolean'. } @@ -51,7 +51,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I5 { [x: string]: Date; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'Date'. } @@ -59,7 +59,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I6 { [x: string]: RegExp; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'RegExp'. } @@ -67,7 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I7 { [x: string]: { bar: number }; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '{ bar: number; }'. } @@ -75,7 +75,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I8 { [x: string]: number[]; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'number[]'. } @@ -83,7 +83,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I9 { [x: string]: I8; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'I8'. } @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I10 { [x: string]: A; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A'. } @@ -99,7 +99,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I11 { [x: string]: A2; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A2'. } @@ -107,7 +107,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I12 { [x: string]: (x) => number; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: any) => number'. } @@ -115,7 +115,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I13 { [x: string]: (x: T) => T; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '(x: T) => T'. } @@ -124,7 +124,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I14 { [x: string]: E2; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'E2'. } @@ -136,7 +136,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I15 { [x: string]: typeof f; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof f'. } @@ -148,7 +148,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I16 { [x: string]: typeof c; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'typeof c'. } @@ -156,7 +156,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I17 { [x: string]: T; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'T'. } @@ -164,7 +164,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/enumIsNotA interface I18 { [x: string]: U; foo: E; - ~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'U'. } diff --git a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt index 51287c87393..a87dc989178 100644 --- a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt +++ b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt @@ -11,6 +11,6 @@ tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(6,5): error TS241 interface Foo { [s: string]: string; prop: number; - ~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'prop' of type 'number' is not assignable to string index type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyCastedValue.errors.txt b/tests/baselines/reference/implicitAnyCastedValue.errors.txt index 773fb2ed94e..508696aaf60 100644 --- a/tests/baselines/reference/implicitAnyCastedValue.errors.txt +++ b/tests/baselines/reference/implicitAnyCastedValue.errors.txt @@ -20,10 +20,10 @@ tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter ' class C { bar = null; // this should be an error - ~~~~~~~~~~~ + ~~~ !!! error TS7008: Member 'bar' implicitly has an 'any' type. foo = undefined; // this should be an error - ~~~~~~~~~~~~~~~~ + ~~~ !!! error TS7008: Member 'foo' implicitly has an 'any' type. public get tempVar() { ~~~~~~~ @@ -42,7 +42,7 @@ tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter ' class C1 { getValue = null; // this should be an error - ~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS7008: Member 'getValue' implicitly has an 'any' type. public get castedGet() { diff --git a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt index 710bcd32470..a450056cee1 100644 --- a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType.errors.txt @@ -12,7 +12,7 @@ tests/cases/compiler/implicitAnyDeclareMemberWithoutType.ts(7,5): error TS7013: // this should be an error interface IFace { member1; // error at "member1" - ~~~~~~~~ + ~~~~~~~ !!! error TS7008: Member 'member1' implicitly has an 'any' type. member2: string; constructor(c1, c2: string, c3); // error at "c1, c3, "constructor" diff --git a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt index 45b95a1c863..bb612980bf0 100644 --- a/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareMemberWithoutType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(3,5): error TS7008: Member 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(3,12): error TS7008: Member 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(6,17): error TS7006: Parameter 'c1' implicitly has an 'any' type. tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(6,21): error TS7006: Parameter 'c2' implicitly has an 'any' type. tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(7,13): error TS7006: Parameter 'f1' implicitly has an 'any' type. @@ -9,7 +9,7 @@ tests/cases/compiler/implicitAnyDeclareMemberWithoutType2.ts(7,17): error TS7006 // this should be an error class C { public x = null;// error at "x" - ~~~~~~~~~~~~~~~~ + ~ !!! error TS7008: Member 'x' implicitly has an 'any' type. public x1: string // no error diff --git a/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt b/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt index 8523b361ba8..5cf97ddfc78 100644 --- a/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareTypePropertyWithoutType.errors.txt @@ -13,12 +13,12 @@ tests/cases/compiler/implicitAnyDeclareTypePropertyWithoutType.ts(10,22): error // this should be an error var x: { y; z; } // error at "y,z" - ~~ + ~ !!! error TS7008: Member 'y' implicitly has an 'any' type. - ~~ + ~ !!! error TS7008: Member 'z' implicitly has an 'any' type. var x1: { y1: C; z1; }; // error at "z1" - ~~~ + ~~ !!! error TS7008: Member 'z1' implicitly has an 'any' type. var x11: { new (); }; // error at "new" ~~~~~~~ diff --git a/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt b/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt index 55108bb803e..ad73dadb53f 100644 --- a/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt +++ b/tests/baselines/reference/implicitAnyFunctionInvocationWithAnyArguements.errors.txt @@ -13,9 +13,9 @@ tests/cases/compiler/implicitAnyFunctionInvocationWithAnyArguements.ts(10,36): e ~~~~~~~~ !!! error TS7005: Variable 'anyArray' implicitly has an 'any[]' type. var objL: { v; w; } // error at "y,z" - ~~ + ~ !!! error TS7008: Member 'v' implicitly has an 'any' type. - ~~ + ~ !!! error TS7008: Member 'w' implicitly has an 'any' type. var funcL: (y2) => number; ~~ diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt index 1e2de97aae0..dac0b5486c9 100644 --- a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt @@ -12,7 +12,7 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): er // these should be errors class GetAndSet { getAndSet = null; // error at "getAndSet" - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS7008: Member 'getAndSet' implicitly has an 'any' type. public get haveGetAndSet() { // this should not be an error ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 493fc13db04..b5e1f64e765 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,9): error TS7008: Member 'publicMember' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,16): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,16): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. @@ -7,7 +7,7 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Par module Test { declare class C { public publicMember; // this should be an error - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS7008: Member 'publicMember' implicitly has an 'any' type. private privateMember; // this should not be an error diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index 03de82c731d..1f760ff61e2 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,18): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,22): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: Variable 'bar' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,12): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,12): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,27): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. @@ -18,7 +18,7 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: !!! error TS7005: Variable 'bar' implicitly has an 'any' type. declare class C { public publicMember; // this should be an error - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS7008: Member 'publicMember' implicitly has an 'any' type. private privateMember; // this should not be an error diff --git a/tests/baselines/reference/interfaceExtendingClass2.errors.txt b/tests/baselines/reference/interfaceExtendingClass2.errors.txt index 3b394d4922a..8c15a845ce8 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass2.errors.txt @@ -16,10 +16,9 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I2 extends Foo { // error a: { - ~~~~ - toString: () => { - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. + toString: () => { return 1; ~~~~~~ !!! error TS1131: Property or signature expected. diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt index 40dc5668eb2..a604a7dc2ec 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer.errors.txt @@ -15,10 +15,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringInde }; // error y: { - ~~~~ - a: number; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS2411: Property 'y' of type '{ a: number; }' is not assignable to string index type '{ a: number; b: number; }'. + a: number; + } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt index ac66d08a83a..a7043f93821 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer2.errors.txt @@ -19,10 +19,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringInde } // error 1: { - ~~~~ - a: number; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS2412: Property '1' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. + a: number; + } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt index 932780aaa1a..b70d4b4a12d 100644 --- a/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt +++ b/tests/baselines/reference/interfaceWithStringIndexerHidingBaseTypeIndexer3.errors.txt @@ -15,10 +15,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithStringInde }; // error 2: { - ~~~~ - a: number; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ + ~ !!! error TS2412: Property '2' of type '{ a: number; }' is not assignable to numeric index type '{ a: number; b: number; }'. + a: number; + } } \ No newline at end of file diff --git a/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt b/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt index 3eff7ad420c..b13b98a1da0 100644 --- a/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt +++ b/tests/baselines/reference/interfacedeclWithIndexerErrors.errors.txt @@ -18,14 +18,14 @@ tests/cases/compiler/interfacedeclWithIndexerErrors.ts(20,5): error TS2411: Prop p1; p2: string; - ~~~~~~~~~~~ + ~~ !!! error TS2411: Property 'p2' of type 'string' is not assignable to string index type '() => string'. p3?; p4?: number; - ~~~~~~~~~~~~ + ~~ !!! error TS2411: Property 'p4' of type 'number' is not assignable to string index type '() => string'. p5: (s: number) =>string; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2411: Property 'p5' of type '(s: number) => string' is not assignable to string index type '() => string'. f1(); diff --git a/tests/baselines/reference/limitDeepInstantiations.errors.txt b/tests/baselines/reference/limitDeepInstantiations.errors.txt index 99ff4c789f4..2b68b787437 100644 --- a/tests/baselines/reference/limitDeepInstantiations.errors.txt +++ b/tests/baselines/reference/limitDeepInstantiations.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/limitDeepInstantiations.ts(3,35): error TS2502: '"true"' is // Repro from #14837 type Foo = { "true": Foo> }[T]; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2502: '"true"' is referenced directly or indirectly in its own type annotation. let f1: Foo<"true", {}>; let f2: Foo<"false", {}>; diff --git a/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt b/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt index 768abc0f9c0..f649b546993 100644 --- a/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithIndexers2.errors.txt @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexe interface A2 { [x: number]: string; 'a': number; //error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property ''a'' of type 'number' is not assignable to string index type '{ length: number; }'. } @@ -28,7 +28,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithIndexe interface A2 { [x: string]: { length: number }; 1: { length: number }; // error - ~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2412: Property '1' of type '{ length: number; }' is not assignable to numeric index type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt index 806cfd39a34..635b0d6f7a5 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/noImplicitAnyWithOverloads.ts(8,16): error TS7006: Paramete ==== tests/cases/compiler/noImplicitAnyWithOverloads.ts (4 errors) ==== interface A { foo; - ~~~~ + ~~~ !!! error TS7008: Member 'foo' implicitly has an 'any' type. } interface B { } diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index f532bd23755..1c25a4a0382 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -31,12 +31,12 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo "e": number; // ok 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. "3.0": string; // ok "4.0": number; // error 3.0: MyNumber // error - ~~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. get X() { // ok @@ -73,7 +73,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo "e": number; // ok 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. (): string; // ok (x): number // ok @@ -93,7 +93,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo "e": number; // ok 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. (): string; // ok (x): number // ok diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index 74cd032c40e..b327c613f30 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo 2.0: B; // ok "2.5": B // ok 3.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error } @@ -33,7 +33,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo 2.0: B; // ok "2.5": B // ok 3.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error } @@ -44,7 +44,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo 2.0: B; // ok "2.5": B // ok 3.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. "4.0": string; // error }; diff --git a/tests/baselines/reference/numericIndexerConstraint.errors.txt b/tests/baselines/reference/numericIndexerConstraint.errors.txt index af24643310a..21d52dee683 100644 --- a/tests/baselines/reference/numericIndexerConstraint.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/numericIndexerConstraint.ts(2,5): error TS2412: Property '0 ==== tests/cases/compiler/numericIndexerConstraint.ts (1 errors) ==== class C { 0: number; - ~~~~~~~~~~ + ~ !!! error TS2412: Property '0' of type 'number' is not assignable to numeric index type 'RegExp'. [x: number]: RegExp; } \ No newline at end of file diff --git a/tests/baselines/reference/objectRestNegative.errors.txt b/tests/baselines/reference/objectRestNegative.errors.txt index ced36a642d6..fef99187d55 100644 --- a/tests/baselines/reference/objectRestNegative.errors.txt +++ b/tests/baselines/reference/objectRestNegative.errors.txt @@ -29,7 +29,7 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th !!! error TS2462: A rest element must be last in a destructuring pattern. } function generic(t: T) { - ~~ + ~ !!! error TS7008: Member 'x' implicitly has an 'any' type. ~ !!! error TS7008: Member 'y' implicitly has an 'any' type. diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt index f11937efb0c..0596281df44 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(3,5): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. +tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(3,12): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(5,5): error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(8,5): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. +tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(8,12): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(10,5): error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(26,12): error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes' has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(28,12): error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes1' has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(32,5): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. +tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(32,12): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(33,5): error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(34,5): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. +tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(34,12): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(35,5): error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(37,12): error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes' has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes1' has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. @@ -16,20 +16,20 @@ tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); export class publicClassWithWithPrivatePropertyTypes { static myPublicStaticProperty = exporter.createExportedWidget1(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. private static myPrivateStaticProperty = exporter.createExportedWidget1(); myPublicProperty = exporter.createExportedWidget1(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. private myPrivateProperty = exporter.createExportedWidget1(); static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); myPublicProperty1 = exporter.createExportedWidget3(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. private myPrivateProperty1 = exporter.createExportedWidget3(); } @@ -57,16 +57,16 @@ tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error export class publicClassWithPrivateModulePropertyTypes { static myPublicStaticProperty= exporter.createExportedWidget2(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. myPublicProperty = exporter.createExportedWidget2(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. myPublicProperty1 = exporter.createExportedWidget4(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. } export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error diff --git a/tests/baselines/reference/propertiesAndIndexers.errors.txt b/tests/baselines/reference/propertiesAndIndexers.errors.txt index 4ab8bba644c..a8c5fe04d2a 100644 --- a/tests/baselines/reference/propertiesAndIndexers.errors.txt +++ b/tests/baselines/reference/propertiesAndIndexers.errors.txt @@ -40,7 +40,7 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' !!! error TS2412: Property '1' of type 'Z' is not assignable to numeric index type 'string'. c: boolean; 3: boolean; - ~~~~~~~~~~~ + ~ !!! error TS2412: Property '3' of type 'boolean' is not assignable to numeric index type 'string'. 6(): string; ~~~~~~~~~~~~ @@ -49,7 +49,7 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' interface B { 4: boolean; - ~~~~~~~~~~~ + ~ !!! error TS2412: Property '4' of type 'boolean' is not assignable to numeric index type 'string'. 5: string; } @@ -63,10 +63,10 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' ~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property 'b' of type 'X' is not assignable to string index type 'number'. c: boolean; - ~~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type 'boolean' is not assignable to string index type 'number'. 3: boolean; - ~~~~~~~~~~~ + ~ !!! error TS2411: Property '3' of type 'boolean' is not assignable to string index type 'number'. } @@ -80,15 +80,15 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' ~ !!! error TS2413: Numeric index type 'string' is not assignable to string index type 'number'. 2: Z; - ~~~~~ + ~ !!! error TS2411: Property '2' of type 'Z' is not assignable to string index type 'number'. - ~~~~~ + ~ !!! error TS2412: Property '2' of type 'Z' is not assignable to numeric index type 'string'. Infinity: number; - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2412: Property 'Infinity' of type 'number' is not assignable to numeric index type 'string'. zoo: string; - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'zoo' of type 'string' is not assignable to string index type 'number'. } @@ -98,7 +98,7 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' class Q extends P { t: number; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 't' of type 'number' is not assignable to string index type 'string'. } @@ -106,6 +106,6 @@ tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2412: Property '3' [n: number]: string; c: boolean; 3: boolean; - ~~~~~~~~~~~ + ~ !!! error TS2412: Property '3' of type 'boolean' is not assignable to numeric index type 'string'. }; \ No newline at end of file diff --git a/tests/baselines/reference/propertiesAndIndexers2.errors.txt b/tests/baselines/reference/propertiesAndIndexers2.errors.txt index e1ab8c9d13d..a616075599a 100644 --- a/tests/baselines/reference/propertiesAndIndexers2.errors.txt +++ b/tests/baselines/reference/propertiesAndIndexers2.errors.txt @@ -20,22 +20,22 @@ tests/cases/compiler/propertiesAndIndexers2.ts(14,5): error TS2412: Property '6' // All of these should fail. interface B extends A { c: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type 'string' is not assignable to string index type 'number'. 3: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property '3' of type 'string' is not assignable to string index type 'number'. Infinity: string; - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2411: Property 'Infinity' of type 'string' is not assignable to string index type 'number'. "-Infinity": string; - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2411: Property '"-Infinity"' of type 'string' is not assignable to string index type 'number'. NaN: string; - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'NaN' of type 'string' is not assignable to string index type 'number'. "-NaN": string; - ~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2411: Property '"-NaN"' of type 'string' is not assignable to string index type 'number'. 6(): string; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/propertiesAndIndexersForNumericNames.errors.txt b/tests/baselines/reference/propertiesAndIndexersForNumericNames.errors.txt index 01dcb61c70c..f256cb0f4c1 100644 --- a/tests/baselines/reference/propertiesAndIndexersForNumericNames.errors.txt +++ b/tests/baselines/reference/propertiesAndIndexersForNumericNames.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(6,5): error TS2412: Property '"1"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(7,5): error TS2412: Property '"-1"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(8,5): error TS2412: Property '"-2.5"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(9,5): error TS2412: Property '"3.141592"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(10,5): error TS2412: Property '"1.2e-20"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(11,5): error TS2412: Property '"Infinity"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(12,5): error TS2412: Property '"-Infinity"' of type 'string' is not assignable to numeric index type 'number'. -tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(13,5): error TS2412: Property '"NaN"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(6,12): error TS2412: Property '"1"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(7,12): error TS2412: Property '"-1"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(8,12): error TS2412: Property '"-2.5"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(9,12): error TS2412: Property '"3.141592"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(10,12): error TS2412: Property '"1.2e-20"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(11,12): error TS2412: Property '"Infinity"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(12,12): error TS2412: Property '"-Infinity"' of type 'string' is not assignable to numeric index type 'number'. +tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(13,12): error TS2412: Property '"NaN"' of type 'string' is not assignable to numeric index type 'number'. ==== tests/cases/compiler/propertiesAndIndexersForNumericNames.ts (8 errors) ==== @@ -15,28 +15,28 @@ tests/cases/compiler/propertiesAndIndexersForNumericNames.ts(13,5): error TS2412 // These all have numeric names; they should error // because their types are not compatible with the numeric indexer. public "1": string = "number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2412: Property '"1"' of type 'string' is not assignable to numeric index type 'number'. public "-1": string = "negative number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2412: Property '"-1"' of type 'string' is not assignable to numeric index type 'number'. public "-2.5": string = "negative number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2412: Property '"-2.5"' of type 'string' is not assignable to numeric index type 'number'. public "3.141592": string = "pi-sitive number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2412: Property '"3.141592"' of type 'string' is not assignable to numeric index type 'number'. public "1.2e-20": string = "really small number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2412: Property '"1.2e-20"' of type 'string' is not assignable to numeric index type 'number'. public "Infinity": string = "A gillion"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2412: Property '"Infinity"' of type 'string' is not assignable to numeric index type 'number'. public "-Infinity": string = "Negative-a-gillion"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2412: Property '"-Infinity"' of type 'string' is not assignable to numeric index type 'number'. public "NaN": string = "not a number"; // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2412: Property '"NaN"' of type 'string' is not assignable to numeric index type 'number'. // These all have *partially* numeric names, diff --git a/tests/baselines/reference/stringIndexerAndConstructor.errors.txt b/tests/baselines/reference/stringIndexerAndConstructor.errors.txt index d98f195f74c..66122d93de9 100644 --- a/tests/baselines/reference/stringIndexerAndConstructor.errors.txt +++ b/tests/baselines/reference/stringIndexerAndConstructor.errors.txt @@ -14,9 +14,9 @@ tests/cases/compiler/stringIndexerAndConstructor.ts(12,5): error TS2411: Propert (): boolean; new (): boolean; "": string; - ~~~~~~~~~~~ + ~~ !!! error TS2411: Property '""' of type 'string' is not assignable to string index type 'number'. d: string; - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'd' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/stringIndexerAndConstructor1.errors.txt b/tests/baselines/reference/stringIndexerAndConstructor1.errors.txt index 2caf30e6fe5..28783924d2c 100644 --- a/tests/baselines/reference/stringIndexerAndConstructor1.errors.txt +++ b/tests/baselines/reference/stringIndexerAndConstructor1.errors.txt @@ -5,6 +5,6 @@ tests/cases/compiler/stringIndexerAndConstructor1.ts(3,5): error TS2411: Propert interface I { [s: string]: number; "": string; - ~~~~~~~~~~~ + ~~ !!! error TS2411: Property '""' of type 'string' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index 606cc39afef..2a847e98b74 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -43,25 +43,25 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: string; // ok b: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'b' of type 'number' is not assignable to string index type 'string'. c: () => {} // error - ~~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type '() => {}' is not assignable to string index type 'string'. "d": string; // ok "e": number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '"e"' of type 'number' is not assignable to string index type 'string'. 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '2.0' of type 'number' is not assignable to string index type 'string'. "3.0": string; // ok "4.0": number; // error - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. f: MyString; // error - ~~~~~~~~~~~~ + ~ !!! error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. get X() { // ok @@ -95,18 +95,18 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: string; // ok b: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'b' of type 'number' is not assignable to string index type 'string'. c: () => {} // error - ~~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type '() => {}' is not assignable to string index type 'string'. "d": string; // ok "e": number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '"e"' of type 'number' is not assignable to string index type 'string'. 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '2.0' of type 'number' is not assignable to string index type 'string'. (): string; // ok (x): number // ok @@ -115,10 +115,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon !!! error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. "3.0": string; // ok "4.0": number; // error - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. f: MyString; // error - ~~~~~~~~~~~~ + ~ !!! error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. } @@ -127,18 +127,18 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: string; // ok b: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'b' of type 'number' is not assignable to string index type 'string'. c: () => {} // error - ~~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type '() => {}' is not assignable to string index type 'string'. "d": string; // ok "e": number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '"e"' of type 'number' is not assignable to string index type 'string'. 1.0: string; // ok 2.0: number; // error - ~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property '2.0' of type 'number' is not assignable to string index type 'string'. (): string; // ok (x): number // ok @@ -147,10 +147,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon !!! error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. "3.0": string; // ok "4.0": number; // error - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. f: MyString; // error - ~~~~~~~~~~~~ + ~ !!! error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. } diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index dacfb1a522d..891da8c8ce9 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -26,10 +26,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: A; // ok b: B; // ok c: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. d: string; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. } @@ -38,10 +38,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: A; // ok b: B; // ok c: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. d: string; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. } @@ -50,10 +50,10 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon a: A; // ok b: B; // ok c: number; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. d: string; // error - ~~~~~~~~~~ + ~ !!! error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt index cff11049787..627a887d437 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt @@ -1,38 +1,38 @@ +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. Type 'V' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. Type 'V' is not assignable to type 'T'. Type 'Date' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2416: Property 'foo' in type 'D23' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. Type 'Date' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2416: Property 'foo' in type 'D24' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. Type 'Date' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2416: Property 'foo' in type 'D27' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'V'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts (20 errors) ==== @@ -56,10 +56,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: U; // error ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } class D4 extends C3 { @@ -92,11 +92,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: U; // error ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. !!! error TS2416: Type 'V' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } class D9 extends C3 { @@ -115,20 +115,20 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. } class D12 extends C3 { [x: string]: U; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. } class D13 extends C3 { @@ -170,12 +170,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: U; // error ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. !!! error TS2416: Type 'V' is not assignable to type 'T'. !!! error TS2416: Type 'Date' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } class D20 extends C3 { @@ -199,22 +199,22 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D23' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. !!! error TS2416: Type 'Date' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. } class D24 extends C3 { [x: string]: U; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D24' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. !!! error TS2416: Type 'Date' is not assignable to type 'U'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. } class D25 extends C3 { @@ -233,28 +233,28 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: Date; // error ~~~ +!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D27' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'T'. - ~~~~~~~~~~ -!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'T'. } class D28 extends C3 { [x: string]: U; foo: Date; // error ~~~ +!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'U'. - ~~~~~~~~~~ -!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. } class D29 extends C3 { [x: string]: V; foo: Date; // error ~~~ +!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. + ~~~ !!! error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'V'. - ~~~~~~~~~~ -!!! error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt index ad85188fb4d..bdf0473df01 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt @@ -1,20 +1,20 @@ +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(47,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(47,5): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'Foo'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(47,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. Type 'U' is not assignable to type 'T'. Type 'Foo' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. Type 'T' is not assignable to type 'U'. Type 'Foo' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2416: Property 'foo' in type 'D9' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts (10 errors) ==== @@ -66,10 +66,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: Foo; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'. + ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'V' is not assignable to type 'Foo'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'Foo'. } class D4 extends B1 { @@ -81,32 +81,32 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: U; // error ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'U' is not assignable to type 'T'. !!! error TS2416: Type 'Foo' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } class D6 extends B1 { [x: string]: T; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'V' is not assignable to type 'T'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. } class D7 extends B1 { [x: string]: U; foo: T; // error ~~~ +!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'T' is not assignable to type 'U'. !!! error TS2416: Type 'Foo' is not assignable to type 'U'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. } class D8 extends B1 { @@ -118,8 +118,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: U; foo: V; // error ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D9' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'V' is not assignable to type 'U'. - ~~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt index c5adf758728..700076db4d1 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.errors.txt @@ -1,63 +1,63 @@ +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2416: Property 'foo' in type 'D2' is not assignable to the same property in base type 'Base'. Type 'U' is not assignable to type 'T'. Type 'Foo' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(73,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(73,9): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'Base'. Type 'V' is not assignable to type 'T'. Type 'Foo' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(73,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(78,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(78,9): error TS2416: Property 'foo' in type 'D4' is not assignable to the same property in base type 'Base'. Type 'T' is not assignable to type 'U'. Type 'Foo' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(78,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(88,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(88,9): error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'Base'. Type 'V' is not assignable to type 'U'. Type 'Foo' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(88,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(93,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(93,9): error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'Base'. Type 'T' is not assignable to type 'V'. Type 'Foo' is not assignable to type 'V'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(93,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'Base'. Type 'U' is not assignable to type 'V'. Type 'Foo' is not assignable to type 'V'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(115,9): error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'Base2'. Type 'T' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'T'. Type 'Foo' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(120,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(125,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(125,9): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'Base2'. Type 'V' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'V' is not assignable to type 'T'. Type 'Foo' is not assignable to type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(125,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(130,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(135,9): error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'Base2'. Type 'U' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'T' is not assignable to type 'U'. Type 'Foo' is not assignable to type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(140,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(140,9): error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'Base2'. Type 'V' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'V' is not assignable to type 'U'. Type 'Foo' is not assignable to type 'U'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(140,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(145,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(145,9): error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'Base2'. Type 'T' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'V'. Type 'Foo' is not assignable to type 'V'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(145,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'Base2'. Type 'U' is not assignable to type 'Foo'. Type 'Foo' is not assignable to type 'Foo'. Type 'T' is not assignable to type 'V'. Type 'Foo' is not assignable to type 'V'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts (24 errors) ==== @@ -130,33 +130,33 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: U ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D2' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'U' is not assignable to type 'T'. !!! error TS2416: Type 'Foo' is not assignable to type 'T'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } class D3, U extends Foo, V extends Foo> extends Base { [x: string]: T; foo: V ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'V' is not assignable to type 'T'. !!! error TS2416: Type 'Foo' is not assignable to type 'T'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. } class D4, U extends Foo, V extends Foo> extends Base { [x: string]: U; foo: T ~~~ +!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D4' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'T' is not assignable to type 'U'. !!! error TS2416: Type 'Foo' is not assignable to type 'U'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. } class D5, U extends Foo, V extends Foo> extends Base { @@ -168,33 +168,33 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: U; foo: V ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'V' is not assignable to type 'U'. !!! error TS2416: Type 'Foo' is not assignable to type 'U'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. } class D7, U extends Foo, V extends Foo> extends Base { [x: string]: V; foo: T ~~~ +!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. + ~~~ !!! error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'T' is not assignable to type 'V'. !!! error TS2416: Type 'Foo' is not assignable to type 'V'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. } class D8, U extends Foo, V extends Foo> extends Base { [x: string]: V; foo: U ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. + ~~~ !!! error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'Base'. !!! error TS2416: Type 'U' is not assignable to type 'V'. !!! error TS2416: Type 'Foo' is not assignable to type 'V'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. } class D9, U extends Foo, V extends Foo> extends Base { @@ -223,7 +223,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf class D2, U extends Foo, V extends Foo> extends Base2 { [x: string]: T; foo: U - ~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. } @@ -231,19 +231,19 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: T; foo: V ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. + ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'Base2'. !!! error TS2416: Type 'V' is not assignable to type 'Foo'. !!! error TS2416: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2416: Type 'V' is not assignable to type 'T'. !!! error TS2416: Type 'Foo' is not assignable to type 'T'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. } class D4, U extends Foo, V extends Foo> extends Base2 { [x: string]: U; foo: T - ~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. } @@ -262,39 +262,39 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf [x: string]: U; foo: V ~~~ +!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. + ~~~ !!! error TS2416: Property 'foo' in type 'D6' is not assignable to the same property in base type 'Base2'. !!! error TS2416: Type 'V' is not assignable to type 'Foo'. !!! error TS2416: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2416: Type 'V' is not assignable to type 'U'. !!! error TS2416: Type 'Foo' is not assignable to type 'U'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. } class D7, U extends Foo, V extends Foo> extends Base2 { [x: string]: V; foo: T ~~~ +!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. + ~~~ !!! error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'Base2'. !!! error TS2416: Type 'T' is not assignable to type 'Foo'. !!! error TS2416: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2416: Type 'U' is not assignable to type 'V'. !!! error TS2416: Type 'Foo' is not assignable to type 'V'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'. } class D8, U extends Foo, V extends Foo> extends Base2 { [x: string]: V; foo: U ~~~ +!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. + ~~~ !!! error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'Base2'. !!! error TS2416: Type 'U' is not assignable to type 'Foo'. !!! error TS2416: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2416: Type 'T' is not assignable to type 'V'. !!! error TS2416: Type 'Foo' is not assignable to type 'V'. - ~~~~~~ -!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'. } class D9, U extends Foo, V extends Foo> extends Base2 { diff --git a/tests/baselines/reference/subtypesOfUnion.errors.txt b/tests/baselines/reference/subtypesOfUnion.errors.txt index 7cbca6cc409..aa30d24f5bd 100644 --- a/tests/baselines/reference/subtypesOfUnion.errors.txt +++ b/tests/baselines/reference/subtypesOfUnion.errors.txt @@ -46,97 +46,97 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf foo2: string; // ok foo3: number; // ok foo4: boolean; // error - ~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'string | number'. foo5: E; // ok - subtype of number foo6: Date; // error - ~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'string | number'. foo7: RegExp; // error - ~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'string | number'. foo8: { bar: number }; // error - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'string | number'. foo9: I8; // error - ~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'string | number'. foo10: A; // error - ~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'string | number'. foo11: A2; // error - ~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'string | number'. foo12: (x) => number; //error - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'string | number'. foo13: (x: T) => T; // error - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'string | number'. foo14: typeof f; // error - ~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'string | number'. foo15: typeof c; // error - ~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'string | number'. foo16: T; // error - ~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'string | number'. foo17: Object; // error - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'string | number'. foo18: {}; // error - ~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'string | number'. } interface I2 { [x: string]: E | number; foo: any; // ok foo2: string; // error - ~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'number'. foo3: number; // ok foo4: boolean; // error - ~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number'. foo5: E; // ok foo6: Date; // error - ~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number'. foo7: RegExp; // error - ~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number'. foo8: { bar: number }; // error - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number'. foo9: I8; // error - ~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number'. foo10: A; // error - ~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number'. foo11: A2; // error - ~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number'. foo12: (x) => number; //error - ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number'. foo13: (x: T) => T; // error - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number'. foo14: typeof f; // error - ~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number'. foo15: typeof c; // error - ~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number'. foo16: T; // error - ~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number'. foo17: Object; // error - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number'. foo18: {}; // error - ~~~~~~~~~~ + ~~~~~ !!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeName1.errors.txt b/tests/baselines/reference/typeName1.errors.txt index 3e99a18552f..6d65f1d83c3 100644 --- a/tests/baselines/reference/typeName1.errors.txt +++ b/tests/baselines/reference/typeName1.errors.txt @@ -50,7 +50,7 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as var x8:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; }=3; ~~ !!! error TS2322: Type '3' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. - ~~~~ + ~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x9:I=3; ~~ @@ -64,7 +64,7 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as var x12:{z:I;x:boolean;y:(s:string)=>boolean;w:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; };}[][]=3; ~~~ !!! error TS2322: Type '3' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. - ~~~~ + ~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x13:{ new(): number; new(n:number):number; x: string; w: {y: number;}; (): {}; } = 3; ~~~ diff --git a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt index ddf5da8881a..da2b98f75bb 100644 --- a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt +++ b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt @@ -46,7 +46,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty [x: string]: number; // S is union type and each constituent type of S is a subtype of T foo: string | number; // error string is not subtype of number - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'number'. foo2: e | number; // ok e and number both subtype of number } @@ -54,10 +54,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I3 { [x: string]: string; foo: string | number; // error numer is not subtype of string - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'string'. foo2: e | number; // error e and number both not subtype of string - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'string'. } @@ -65,10 +65,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I4 { [x: string]: boolean; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'boolean'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'boolean'. } @@ -76,10 +76,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I5 { [x: string]: Date; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'Date'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'Date'. } @@ -87,10 +87,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I6 { [x: string]: RegExp; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'RegExp'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'RegExp'. } @@ -98,10 +98,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I7 { [x: string]: { bar: number }; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '{ bar: number; }'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type '{ bar: number; }'. } @@ -109,10 +109,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I8 { [x: string]: number[]; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'number[]'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'number[]'. } @@ -120,10 +120,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I9 { [x: string]: I8; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'I8'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'I8'. } @@ -131,10 +131,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I10 { [x: string]: A; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'A'. } @@ -142,10 +142,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I11 { [x: string]: A2; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A2'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'A2'. } @@ -153,10 +153,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I12 { [x: string]: (x) => number; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: any) => number'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type '(x: any) => number'. } @@ -164,10 +164,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I13 { [x: string]: (x: T) => T; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: T) => T'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type '(x: T) => T'. } @@ -176,7 +176,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I14 { [x: string]: E2; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'E2'. foo2: e | number; } @@ -189,10 +189,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I15 { [x: string]: typeof f; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof f'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'typeof f'. } @@ -204,10 +204,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I16 { [x: string]: typeof c; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof c'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'typeof c'. } @@ -215,10 +215,10 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty interface I17 { [x: string]: T; foo: string | number; - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'T'. foo2: e | number; - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'T'. } diff --git a/tests/cases/compiler/classPropertyErrorOnNameOnly.ts b/tests/cases/compiler/classPropertyErrorOnNameOnly.ts new file mode 100644 index 00000000000..44e9d30e485 --- /dev/null +++ b/tests/cases/compiler/classPropertyErrorOnNameOnly.ts @@ -0,0 +1,39 @@ +// @strict: true +type Values = 1 | 2 | 3 | 4 | 5 | 6 + +type FuncType = (arg: Values) => string + +// turn on strictNullChecks +class Example { + insideClass: FuncType = function(val) { // error span goes from here + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } + } // all the way to here +} + +const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case + switch (val) { + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3" + case 4: + return "4" + case 5: + return "5" + // forgot case 6 + } +} \ No newline at end of file