Skip to content

Commit 71f3e1f

Browse files
committed
Accept new baselines
1 parent b49a343 commit 71f3e1f

File tree

3 files changed

+2
-42
lines changed

3 files changed

+2
-42
lines changed

tests/baselines/reference/keyofAndIndexedAccess2.errors.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,16 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(18,5): error TS232
1111
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type 'T'.
1212
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'.
1313
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'.
14-
Type '1' is not assignable to type 'T[string] & T[number]'.
15-
Type '1' is not assignable to type 'T[string]'.
1614
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'.
1715
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(45,3): error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature.
1816
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(46,3): error TS2322: Type '123' is not assignable to type 'string & number'.
1917
Type '123' is not assignable to type 'string'.
2018
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(47,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
21-
Type '123' is not assignable to type 'T["a"] & T["b"]'.
22-
Type '123' is not assignable to type 'T["a"]'.
23-
Type '123' is not assignable to type 'string'.
2419
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(48,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
25-
Type '123' is not assignable to type 'T["a"] & T["b"]'.
26-
Type '123' is not assignable to type 'T["a"]'.
2720
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(60,7): error TS2339: Property 'foo' does not exist on type 'T'.
2821
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(61,3): error TS2536: Type 'string' cannot be used to index type 'T'.
2922
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(62,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
30-
Type '123' is not assignable to type 'T[string]'.
3123
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(63,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
32-
Type '123' is not assignable to type 'T[string]'.
3324
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS2322: Type '123' is not assignable to type 'Type[K]'.
3425
Type '123' is not assignable to type '123 & "some string"'.
3526
Type '123' is not assignable to type '"some string"'.
@@ -88,8 +79,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
8879
c[k] = 1; // Error, cannot write to index signature through constraint
8980
~~~~
9081
!!! error TS2322: Type '1' is not assignable to type 'T[keyof T]'.
91-
!!! error TS2322: Type '1' is not assignable to type 'T[string] & T[number]'.
92-
!!! error TS2322: Type '1' is not assignable to type 'T[string]'.
9382
}
9483

9584
function f3<K extends string>(a: { [P in K]: number }, b: { [key: string]: number }, k: K) {
@@ -119,14 +108,9 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
119108
obj[k3] = 123; // Error
120109
~~~~~~~
121110
!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
122-
!!! error TS2322: Type '123' is not assignable to type 'T["a"] & T["b"]'.
123-
!!! error TS2322: Type '123' is not assignable to type 'T["a"]'.
124-
!!! error TS2322: Type '123' is not assignable to type 'string'.
125111
obj[k4] = 123; // Error
126112
~~~~~~~
127113
!!! error TS2322: Type '123' is not assignable to type 'T[K]'.
128-
!!! error TS2322: Type '123' is not assignable to type 'T["a"] & T["b"]'.
129-
!!! error TS2322: Type '123' is not assignable to type 'T["a"]'.
130114
}
131115

132116
type Dict = Record<string, number>;
@@ -147,11 +131,9 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
147131
obj[k2] = 123; // Error
148132
~~~~~~~
149133
!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
150-
!!! error TS2322: Type '123' is not assignable to type 'T[string]'.
151134
obj[k3] = 123; // Error
152135
~~~~~~~
153136
!!! error TS2322: Type '123' is not assignable to type 'T[K]'.
154-
!!! error TS2322: Type '123' is not assignable to type 'T[string]'.
155137
}
156138

157139
// Repro from #27895

tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error
6464
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'.
6565
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'.
6666
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'.
67-
Type '42' is not assignable to type 'T[string]'.
6867
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'.
69-
Type '"hello"' is not assignable to type 'T[string]'.
7068
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'.
71-
Type 'number[]' is not assignable to type 'T[string]'.
7269

7370

7471
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (41 errors) ====
@@ -317,15 +314,12 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
317314
t[k] = 42; // Error
318315
~~~~
319316
!!! error TS2322: Type '42' is not assignable to type 'T[K]'.
320-
!!! error TS2322: Type '42' is not assignable to type 'T[string]'.
321317
t[k] = "hello"; // Error
322318
~~~~
323319
!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'.
324-
!!! error TS2322: Type '"hello"' is not assignable to type 'T[string]'.
325320
t[k] = [10, 20]; // Error
326321
~~~~
327322
!!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'.
328-
!!! error TS2322: Type 'number[]' is not assignable to type 'T[string]'.
329323
}
330324

331325
// Repro from #28839

tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
33
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(9,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
44
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(12,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
55
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(15,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
6+
Type 'string' is not assignable to type 'never'.
67
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(18,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
7-
Type 'string' is not assignable to type 'T["toString"] & T["toFixed"] & T["toExponential"] & T["toPrecision"] & T["valueOf"] & T["toLocaleString"]'.
8-
Type 'string' is not assignable to type 'T["toString"]'.
9-
Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
108
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
11-
Type 'string' is not assignable to type 'T[number] & T["toString"] & T["valueOf"] & T["charAt"] & T["charCodeAt"] & T["concat"] & T["indexOf"] & T["lastIndexOf"] & T["localeCompare"] & T["match"] & T["replace"] & T["search"] & T["slice"] & T["split"] & T["substring"] & T["toLowerCase"] & T["toLocaleLowerCase"] & T["toUpperCase"] & T["toLocaleUpperCase"] & T["trim"] & T["length"] & T["substr"]'.
12-
Type 'string' is not assignable to type 'T[number]'.
139
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(24,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
1410
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(27,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
15-
Type 'string' is not assignable to type 'T["a"]'.
16-
Type 'string' is not assignable to type 'number'.
1711
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(30,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
18-
Type 'string' is not assignable to type 'T[string] & T[number]'.
19-
Type 'string' is not assignable to type 'T[string]'.
2012

2113

2214
==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ====
@@ -45,21 +37,17 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
4537
tp = s;
4638
~~
4739
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
40+
!!! error TS2322: Type 'string' is not assignable to type 'never'.
4841
}
4942
function k<T extends number, P extends keyof T>(s: string, tp: T[P]): void {
5043
tp = s;
5144
~~
5245
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
53-
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"] & T["toFixed"] & T["toExponential"] & T["toPrecision"] & T["valueOf"] & T["toLocaleString"]'.
54-
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"]'.
55-
!!! error TS2322: Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
5646
}
5747
function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
5848
tp = s;
5949
~~
6050
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
61-
!!! error TS2322: Type 'string' is not assignable to type 'T[number] & T["toString"] & T["valueOf"] & T["charAt"] & T["charCodeAt"] & T["concat"] & T["indexOf"] & T["lastIndexOf"] & T["localeCompare"] & T["match"] & T["replace"] & T["search"] & T["slice"] & T["split"] & T["substring"] & T["toLowerCase"] & T["toLocaleLowerCase"] & T["toUpperCase"] & T["toLocaleUpperCase"] & T["trim"] & T["length"] & T["substr"]'.
62-
!!! error TS2322: Type 'string' is not assignable to type 'T[number]'.
6351
}
6452
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
6553
tp = s;
@@ -70,14 +58,10 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
7058
tp = s;
7159
~~
7260
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
73-
!!! error TS2322: Type 'string' is not assignable to type 'T["a"]'.
74-
!!! error TS2322: Type 'string' is not assignable to type 'number'.
7561
}
7662
function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
7763
tp = s;
7864
~~
7965
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
80-
!!! error TS2322: Type 'string' is not assignable to type 'T[string] & T[number]'.
81-
!!! error TS2322: Type 'string' is not assignable to type 'T[string]'.
8266
}
8367

0 commit comments

Comments
 (0)