You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/baselines/reference/indexSignatureTypeCheck.errors.txt
+39-29Lines changed: 39 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
-
tests/cases/compiler/indexSignatureTypeCheck.ts(35,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
2
-
tests/cases/compiler/indexSignatureTypeCheck.ts(38,8): error TS1019: An index signature parameter cannot have a question mark.
3
-
tests/cases/compiler/indexSignatureTypeCheck.ts(39,6): error TS1017: An index signature cannot have a rest parameter.
1
+
tests/cases/compiler/indexSignatureTypeCheck.ts(34,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
2
+
tests/cases/compiler/indexSignatureTypeCheck.ts(37,8): error TS1019: An index signature parameter cannot have a question mark.
3
+
tests/cases/compiler/indexSignatureTypeCheck.ts(38,6): error TS1017: An index signature cannot have a rest parameter.
4
+
tests/cases/compiler/indexSignatureTypeCheck.ts(39,6): error TS1096: An index signature must have exactly one parameter.
4
5
tests/cases/compiler/indexSignatureTypeCheck.ts(40,6): error TS1096: An index signature must have exactly one parameter.
5
-
tests/cases/compiler/indexSignatureTypeCheck.ts(41,6): error TS1096: An index signature must have exactly one parameter.
6
-
tests/cases/compiler/indexSignatureTypeCheck.ts(51,2): error TS2375: Duplicate number index signature.
7
-
tests/cases/compiler/indexSignatureTypeCheck.ts(56,2): error TS2375: Duplicate number index signature.
8
-
tests/cases/compiler/indexSignatureTypeCheck.ts(64,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }'.
6
+
tests/cases/compiler/indexSignatureTypeCheck.ts(50,5): error TS2375: Duplicate number index signature.
7
+
tests/cases/compiler/indexSignatureTypeCheck.ts(55,5): error TS2375: Duplicate number index signature.
8
+
tests/cases/compiler/indexSignatureTypeCheck.ts(65,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: string]: string; }'.
9
9
Index signature is missing in type '{ [x: number]: string; }'.
10
-
tests/cases/compiler/indexSignatureTypeCheck.ts(65,1): error TS2322: Type '{ [x: number]: number; }' is not assignable to type '{ [x: string]: string; }'.
10
+
tests/cases/compiler/indexSignatureTypeCheck.ts(66,1): error TS2322: Type '{ [x: number]: number; }' is not assignable to type '{ [x: string]: string; }'.
11
11
Index signature is missing in type '{ [x: number]: number; }'.
12
-
tests/cases/compiler/indexSignatureTypeCheck.ts(69,1): error TS2322: Type '{ [x: number]: number; }' is not assignable to type '{ [x: number]: string; }'.
12
+
tests/cases/compiler/indexSignatureTypeCheck.ts(70,1): error TS2322: Type '{ [x: number]: number; }' is not assignable to type '{ [x: number]: string; }'.
13
13
Index signatures are incompatible.
14
14
Type 'number' is not assignable to type 'string'.
15
-
tests/cases/compiler/indexSignatureTypeCheck.ts(71,1): error TS2322: Type '{ [x: string]: string; }' is not assignable to type '{ [x: number]: number; }'.
15
+
tests/cases/compiler/indexSignatureTypeCheck.ts(72,1): error TS2322: Type '{ [x: string]: string; }' is not assignable to type '{ [x: number]: number; }'.
16
16
Index signatures are incompatible.
17
17
Type 'string' is not assignable to type 'number'.
18
-
tests/cases/compiler/indexSignatureTypeCheck.ts(72,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: number]: number; }'.
18
+
tests/cases/compiler/indexSignatureTypeCheck.ts(73,1): error TS2322: Type '{ [x: number]: string; }' is not assignable to type '{ [x: number]: number; }'.
19
19
Index signatures are incompatible.
20
20
Type 'string' is not assignable to type 'number'.
21
21
@@ -29,31 +29,30 @@ tests/cases/compiler/indexSignatureTypeCheck.ts(72,1): error TS2322: Type '{ [x:
29
29
var index: any = "hello";
30
30
ps[index] = 12;
31
31
32
-
enum Val {
32
+
enum Values {
33
33
a = 1,
34
34
b = 2
35
35
}
36
36
37
-
type Val2 = Val;
38
-
type Val3 = number;
37
+
type Values2 = Values;
38
+
type Values3 = number;
39
39
40
-
interface IEnum {
41
-
[index: Val]: Val;
40
+
interface EnumMap {
41
+
[index: Values]: Values;
42
42
}
43
43
44
-
45
-
interface IEnum2 {
46
-
[index: Val2]: Val2;
44
+
interface EnumMap2 {
45
+
[index: Values2]: Values2;
47
46
}
48
-
interface IEnum3 {
49
-
[index: Val3]: Val3;
47
+
interface NumberMap {
48
+
[index: Values3]: Values3;
50
49
}
51
50
52
-
var pe: IEnum = null;
51
+
var pe: Values = null;
53
52
54
53
pe[1] = null
55
54
pe[3] = null
56
-
pe[Val.b] = 5
55
+
pe[Values.b] = 5
57
56
58
57
pe[true] = null
59
58
~~~~~~~~
@@ -80,21 +79,23 @@ tests/cases/compiler/indexSignatureTypeCheck.ts(72,1): error TS2322: Type '{ [x:
80
79
81
80
82
81
interface DuplicateAccess {
83
-
[index: Val]: Val;
84
-
[index: Val2]: Val2;
85
-
~~~~~~~~~~~~~~~~~~~~
82
+
[index: Values]: Values;
83
+
[index: Values2]: Values2;
84
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
86
85
!!! error TS2375: Duplicate number index signature.
87
86
}
88
87
89
88
interface DuplicateAccess2 {
90
-
[index: number]: Val;
91
-
[index: Val3]: Val3;
92
-
~~~~~~~~~~~~~~~~~~~~
89
+
[index: number]: Values;
90
+
[index: Values3]: Values3;
91
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
93
92
!!! error TS2375: Duplicate number index signature.
94
93
}
95
94
96
95
var x: { [x: string]: string }
96
+
var xn: {[x: string]: number }
97
97
var y: { [x: number]: string }
98
+
var yn: { [x: number]: number }
98
99
var z: { [x: E]: number }
99
100
100
101
x = x;
@@ -126,5 +127,14 @@ tests/cases/compiler/indexSignatureTypeCheck.ts(72,1): error TS2322: Type '{ [x:
126
127
!!! error TS2322: Index signatures are incompatible.
127
128
!!! error TS2322: Type 'string' is not assignable to type 'number'.
0 commit comments