Skip to content

Commit e79e0bd

Browse files
committed
Accept new baselines
1 parent 1648d0c commit e79e0bd

6 files changed

+44
-21
lines changed

tests/baselines/reference/indexSignatureAndMappedType.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
tests/cases/compiler/indexSignatureAndMappedType.ts(6,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record<K, T>'.
21
tests/cases/compiler/indexSignatureAndMappedType.ts(15,5): error TS2322: Type 'Record<K, U>' is not assignable to type '{ [key: string]: T; }'.
32
Type 'U' is not assignable to type 'T'.
43
tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record<K, U>'.
54

65

7-
==== tests/cases/compiler/indexSignatureAndMappedType.ts (3 errors) ====
6+
==== tests/cases/compiler/indexSignatureAndMappedType.ts (2 errors) ====
87
// A mapped type { [P in K]: X }, where K is a generic type, is related to
98
// { [key: string]: Y } if X is related to Y.
109

1110
function f1<T, K extends string>(x: { [key: string]: T }, y: Record<K, T>) {
1211
x = y;
1312
y = x; // Error
14-
~
15-
!!! error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record<K, T>'.
1613
}
1714

1815
function f2<T>(x: { [key: string]: T }, y: Record<string, T>) {

tests/baselines/reference/infiniteConstraints.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
tests/cases/compiler/infiniteConstraints.ts(3,37): error TS2589: Type instantiation is excessively deep and possibly infinite.
21
tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
32
tests/cases/compiler/infiniteConstraints.ts(21,21): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[K], Record<"val", string>>'.
43
tests/cases/compiler/infiniteConstraints.ts(21,57): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[Exclude<keyof T, K>], Record<"val", string>>'.
@@ -7,12 +6,10 @@ tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"
76
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
87

98

10-
==== tests/cases/compiler/infiniteConstraints.ts (7 errors) ====
9+
==== tests/cases/compiler/infiniteConstraints.ts (6 errors) ====
1110
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
1211

1312
type T1<B extends { [K in keyof B]: Extract<B[Exclude<keyof B, K>], { val: string }>["val"] }> = B;
14-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15-
!!! error TS2589: Type instantiation is excessively deep and possibly infinite.
1613
type T2<B extends { [K in keyof B]: B[Exclude<keyof B, K>]["val"] }> = B;
1714
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1815
!!! error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.

tests/baselines/reference/mappedTypeErrors2.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(9,30): error TS2536: Type 'K' cannot be used to index type 'T1<K>'.
22
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(13,30): error TS2536: Type 'K' cannot be used to index type 'T3'.
3+
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,38): error TS2536: Type 'S' cannot be used to index type '{ [key in AB[S]]: true; }'.
34
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
45
Type 'AB[S]' is not assignable to type 'symbol'.
56
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2536: Type 'S' cannot be used to index type 'AB'.
67
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(17,49): error TS2536: Type 'L' cannot be used to index type '{ [key in AB[S]]: true; }'.
78

89

9-
==== tests/cases/conformance/types/mapped/mappedTypeErrors2.ts (5 errors) ====
10+
==== tests/cases/conformance/types/mapped/mappedTypeErrors2.ts (6 errors) ====
1011
// Repros from #17238
1112

1213
type AB = {
@@ -26,6 +27,8 @@ tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(17,49): error TS2536:
2627
!!! error TS2536: Type 'K' cannot be used to index type 'T3'.
2728

2829
type T5<S extends 'a'|'b'|'extra'> = {[key in AB[S]]: true}[S]; // Error
30+
~~~~~~~~~~~~~~~~~~~~~~~~~
31+
!!! error TS2536: Type 'S' cannot be used to index type '{ [key in AB[S]]: true; }'.
2932
~~~~~
3033
!!! error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
3134
!!! error TS2322: Type 'AB[S]' is not assignable to type 'symbol'.

tests/baselines/reference/mappedTypeRelationships.errors.txt

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(35,5): error TS2
1313
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(40,5): error TS2322: Type 'U[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
1414
Type 'undefined' is not assignable to type 'T[keyof T]'.
1515
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
16-
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
17-
Type 'T' is not assignable to type 'U'.
16+
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
17+
Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
18+
Type 'T[string]' is not assignable to type 'U[keyof T]'.
19+
Type 'T' is not assignable to type 'U'.
20+
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
21+
Type 'T' is not assignable to type 'U'.
1822
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(45,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'.
1923
Type 'undefined' is not assignable to type 'T[K]'.
2024
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
21-
Type 'T[K]' is not assignable to type 'U[K]'.
22-
Type 'T' is not assignable to type 'U'.
25+
Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
26+
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
27+
Type 'T[string]' is not assignable to type 'U[K] | undefined'.
28+
Type 'T[string]' is not assignable to type 'U[K]'.
29+
Type 'T' is not assignable to type 'U'.
30+
Type 'T[keyof T]' is not assignable to type 'U[K]'.
31+
Type 'T' is not assignable to type 'U'.
32+
Type 'T[K]' is not assignable to type 'U[K]'.
33+
Type 'T' is not assignable to type 'U'.
2334
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
2435
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
2536
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
@@ -123,8 +134,12 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
123134
y[k] = x[k]; // Error
124135
~~~~
125136
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
126-
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
127-
!!! error TS2322: Type 'T' is not assignable to type 'U'.
137+
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
138+
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
139+
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
140+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
141+
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
142+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
128143
}
129144

130145
function f13<T, U extends T, K extends keyof T>(x: T, y: Partial<U>, k: K) {
@@ -135,8 +150,15 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
135150
y[k] = x[k]; // Error
136151
~~~~
137152
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
138-
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
139-
!!! error TS2322: Type 'T' is not assignable to type 'U'.
153+
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
154+
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
155+
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K] | undefined'.
156+
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
157+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
158+
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[K]'.
159+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
160+
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
161+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
140162
}
141163

142164
function f20<T>(x: T, y: Readonly<T>, k: keyof T) {

tests/baselines/reference/mappedTypes6.errors.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(24,5): error TS2322: Type '
33
tests/cases/conformance/types/mapped/mappedTypes6.ts(27,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
44
tests/cases/conformance/types/mapped/mappedTypes6.ts(37,5): error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
55
Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
6+
Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
7+
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
8+
Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
69
tests/cases/conformance/types/mapped/mappedTypes6.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.
710
tests/cases/conformance/types/mapped/mappedTypes6.ts(39,5): error TS2322: Type 'Partial<T>' is not assignable to type 'Denullified<T>'.
811
tests/cases/conformance/types/mapped/mappedTypes6.ts(42,5): error TS2322: Type 'T' is not assignable to type 'Required<T>'.
@@ -67,6 +70,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno
6770
~
6871
!!! error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
6972
!!! error TS2322: Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
73+
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
74+
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
75+
!!! error TS2322: Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
7076
w = y; // Error
7177
~
7278
!!! error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.

tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
99
Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
1010
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
1111
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["toString"]'.
13-
Type 'string' is not assignable to type '() => string'.
12+
Type 'string' is not assignable to type 'T[number]'.
1413
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(24,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
1514
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(27,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
1615
Type 'string' is not assignable to type 'T["a"]'.
@@ -61,8 +60,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
6160
~~
6261
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
6362
!!! 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"]'.
64-
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"]'.
65-
!!! error TS2322: Type 'string' is not assignable to type '() => string'.
63+
!!! error TS2322: Type 'string' is not assignable to type 'T[number]'.
6664
}
6765
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
6866
tp = s;

0 commit comments

Comments
 (0)