mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Move property errors to the name for the error span (#23865)
This commit is contained in:
@@ -688,6 +688,8 @@ namespace ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
errorNode = (<NamedDeclaration>node).name;
|
||||
break;
|
||||
case SyntaxKind.ArrowFunction:
|
||||
|
||||
+2
-2
@@ -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.
|
||||
}
|
||||
@@ -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<K extends "x" | "y"> = {
|
||||
x: T2<K>[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<T extends T4<T>> {
|
||||
x: T4<T>["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.
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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;}[] = [<foo>({})]; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! 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'.
|
||||
@@ -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 '{}'.
|
||||
@@ -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; }'.
|
||||
}
|
||||
|
||||
|
||||
@@ -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<number>;
|
||||
foo: E;
|
||||
~~~~~~~
|
||||
~~~
|
||||
!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'A2<number>'.
|
||||
}
|
||||
|
||||
@@ -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]: <T>(x: T) => T;
|
||||
foo: E;
|
||||
~~~~~~~
|
||||
~~~
|
||||
!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type '<T>(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<T> {
|
||||
[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<T, U extends T> {
|
||||
[x: string]: U;
|
||||
foo: E;
|
||||
~~~~~~~
|
||||
~~~
|
||||
!!! error TS2411: Property 'foo' of type 'E' is not assignable to string index type 'U'.
|
||||
}
|
||||
|
||||
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
~~~~~~~
|
||||
|
||||
@@ -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;
|
||||
~~
|
||||
|
||||
@@ -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
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
+3
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/compiler/limitDeepInstantiations.ts(3,35): error TS2502: '"true"' is
|
||||
// Repro from #14837
|
||||
|
||||
type Foo<T extends "true", B> = { "true": Foo<T, Foo<T, B>> }[T];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2502: '"true"' is referenced directly or indirectly in its own type annotation.
|
||||
let f1: Foo<"true", {}>;
|
||||
let f2: Foo<"false", {}>;
|
||||
|
||||
@@ -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'.
|
||||
}
|
||||
|
||||
@@ -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 { }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 extends { x, y }>(t: T) {
|
||||
~~
|
||||
~
|
||||
!!! error TS7008: Member 'x' implicitly has an 'any' type.
|
||||
~
|
||||
!!! error TS7008: Member 'y' implicitly has an 'any' type.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'.
|
||||
};
|
||||
@@ -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;
|
||||
~~~~~~~~~~~~
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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'.
|
||||
}
|
||||
@@ -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'.
|
||||
}
|
||||
|
||||
|
||||
@@ -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'.
|
||||
};
|
||||
|
||||
|
||||
@@ -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<T, U>' is not assignable to the same property in base type 'C3<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<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(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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'C3<V>'.
|
||||
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<T, U>' is not assignable to the same property in base type 'C3<T>'.
|
||||
!!! 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<T extends U, U> extends C3<U> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
!!! 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<T extends U, U extends V, V> extends C3<U> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
!!! 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<T extends U, U extends V, V> extends C3<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
!!! 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<T extends U, U extends V, V> extends C3<V> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
!!! 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<T extends U, U extends V, V extends Date> extends C3<U> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'C3<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 'V' is not assignable to string index type 'T'.
|
||||
}
|
||||
|
||||
class D24<T extends U, U extends V, V extends Date> extends C3<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
!!! 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<T extends U, U extends V, V extends Date> extends C3<V> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
|
||||
!!! 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<T extends U, U extends V, V extends Date> extends C3<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
|
||||
!!! 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<T extends U, U extends V, V extends Date> extends C3<V> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'C3<V>'.
|
||||
!!! 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'.
|
||||
}
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'B1<Foo>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
|
||||
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<T, U, V>' is not assignable to the same property in base type 'B1<Foo>'.
|
||||
!!! 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<T extends Foo, U extends Foo, V> extends B1<T> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
|
||||
!!! 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<T extends Foo, U extends Foo, V> extends B1<T> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
|
||||
!!! 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<T extends Foo, U extends Foo, V> extends B1<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
|
||||
!!! 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<T extends Foo, U extends Foo, V> extends B1<U> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
|
||||
!!! 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'.
|
||||
}
|
||||
+32
-32
@@ -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<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
|
||||
Type 'U' is not assignable to type 'T'.
|
||||
Type 'Foo<T>' 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<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
|
||||
Type 'V' is not assignable to type 'T'.
|
||||
Type 'Foo<V>' 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<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'Foo<U>' 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<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
|
||||
Type 'V' is not assignable to type 'U'.
|
||||
Type 'Foo<V>' 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<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
|
||||
Type 'T' is not assignable to type 'V'.
|
||||
Type 'Foo<U>' 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<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
|
||||
Type 'U' is not assignable to type 'V'.
|
||||
Type 'Foo<T>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<T>'.
|
||||
Type 'T' is not assignable to type 'Foo<T>'.
|
||||
Type 'Foo<U>' is not assignable to type 'Foo<T>'.
|
||||
Type 'U' is not assignable to type 'T'.
|
||||
Type 'Foo<T>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<T>'.
|
||||
Type 'V' is not assignable to type 'Foo<T>'.
|
||||
Type 'Foo<V>' is not assignable to type 'Foo<T>'.
|
||||
Type 'V' is not assignable to type 'T'.
|
||||
Type 'Foo<V>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<U>'.
|
||||
Type 'U' is not assignable to type 'Foo<U>'.
|
||||
Type 'Foo<T>' is not assignable to type 'Foo<U>'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'Foo<U>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<U>'.
|
||||
Type 'V' is not assignable to type 'Foo<U>'.
|
||||
Type 'Foo<V>' is not assignable to type 'Foo<U>'.
|
||||
Type 'V' is not assignable to type 'U'.
|
||||
Type 'Foo<V>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
|
||||
Type 'T' is not assignable to type 'Foo<V>'.
|
||||
Type 'Foo<U>' is not assignable to type 'Foo<V>'.
|
||||
Type 'U' is not assignable to type 'V'.
|
||||
Type 'Foo<T>' 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<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
|
||||
Type 'U' is not assignable to type 'Foo<V>'.
|
||||
Type 'Foo<T>' is not assignable to type 'Foo<V>'.
|
||||
Type 'T' is not assignable to type 'V'.
|
||||
Type 'Foo<U>' 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<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
|
||||
!!! error TS2416: Type 'U' is not assignable to type 'T'.
|
||||
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'T'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'.
|
||||
}
|
||||
|
||||
class D3<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<T> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'T'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'T'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
|
||||
}
|
||||
|
||||
class D4<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
|
||||
!!! error TS2416: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'U'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'.
|
||||
}
|
||||
|
||||
class D5<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<U> {
|
||||
@@ -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<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'U'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'U'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
|
||||
}
|
||||
|
||||
class D7<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
|
||||
!!! error TS2416: Type 'T' is not assignable to type 'V'.
|
||||
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'V'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'.
|
||||
}
|
||||
|
||||
class D8<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
|
||||
!!! error TS2416: Type 'U' is not assignable to type 'V'.
|
||||
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'V'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'.
|
||||
}
|
||||
|
||||
class D9<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
|
||||
@@ -223,7 +223,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
|
||||
class D2<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<T> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base2<T>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'Foo<T>'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'Foo<T>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'T'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'T'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
|
||||
}
|
||||
|
||||
class D4<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<U> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base2<U>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'Foo<U>'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'Foo<U>'.
|
||||
!!! error TS2416: Type 'V' is not assignable to type 'U'.
|
||||
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'U'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
|
||||
}
|
||||
|
||||
class D7<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
|
||||
!!! error TS2416: Type 'T' is not assignable to type 'Foo<V>'.
|
||||
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'Foo<V>'.
|
||||
!!! error TS2416: Type 'U' is not assignable to type 'V'.
|
||||
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'V'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'.
|
||||
}
|
||||
|
||||
class D8<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {
|
||||
[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<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
|
||||
!!! error TS2416: Type 'U' is not assignable to type 'Foo<V>'.
|
||||
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'Foo<V>'.
|
||||
!!! error TS2416: Type 'T' is not assignable to type 'V'.
|
||||
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'V'.
|
||||
~~~~~~
|
||||
!!! error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'.
|
||||
}
|
||||
|
||||
class D9<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {
|
||||
|
||||
@@ -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<number>; // error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2411: Property 'foo11' of type 'A2<number>' 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: <T>(x: T) => T; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2411: Property 'foo13' of type '<T>(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<T> {
|
||||
[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<number>; // error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2411: Property 'foo11' of type 'A2<number>' 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: <T>(x: T) => T; // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2411: Property 'foo13' of type '<T>(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'.
|
||||
}
|
||||
@@ -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;
|
||||
~~~
|
||||
|
||||
@@ -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<number>;
|
||||
foo: string | number;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A2<number>'.
|
||||
foo2: e | number;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type 'A2<number>'.
|
||||
}
|
||||
|
||||
@@ -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]: <T>(x: T) => T;
|
||||
foo: string | number;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~
|
||||
!!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '<T>(x: T) => T'.
|
||||
foo2: e | number;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2411: Property 'foo2' of type 'number' is not assignable to string index type '<T>(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<T> {
|
||||
[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'.
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user