Skip to content

Commit 3e09d29

Browse files
committed
Accept new baselines
1 parent 95c8a92 commit 3e09d29

8 files changed

+37
-35
lines changed

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,8 @@ declare namespace ts {
23592359
objectType: Type;
23602360
indexType: Type;
23612361
constraint?: Type;
2362-
simplified?: Type;
2362+
simplifiedForReading?: Type;
2363+
simplifiedForWriting?: Type;
23632364
}
23642365
type TypeVariable = TypeParameter | IndexedAccessType;
23652366
interface IndexType extends InstantiableType {

tests/baselines/reference/api/typescript.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,8 @@ declare namespace ts {
23592359
objectType: Type;
23602360
indexType: Type;
23612361
constraint?: Type;
2362-
simplified?: Type;
2362+
simplifiedForReading?: Type;
2363+
simplifiedForWriting?: Type;
23632364
}
23642365
type TypeVariable = TypeParameter | IndexedAccessType;
23652366
interface IndexType extends InstantiableType {

tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error
6363
Type 'T' is not assignable to type 'U'.
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'.
66-
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'.
67-
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'.
68-
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'.
6966

7067

71-
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (41 errors) ====
68+
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (38 errors) ====
7269
class Shape {
7370
name: string;
7471
width: number;
@@ -312,14 +309,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
312309

313310
function test1<T extends Record<string, any>, K extends keyof T>(t: T, k: K) {
314311
t[k] = 42; // Error
315-
~~~~
316-
!!! error TS2322: Type '42' is not assignable to type 'T[K]'.
317312
t[k] = "hello"; // Error
318-
~~~~
319-
!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'.
320313
t[k] = [10, 20]; // Error
321-
~~~~
322-
!!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'.
323314
}
324315

325316
// Repro from #28839

tests/baselines/reference/keyofAndIndexedAccessErrors.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ function f20<T, U>(x: T | U, y: T & U, k1: keyof (T | U), k2: keyof T & keyof U,
223223
>k2 : keyof T & keyof U
224224

225225
x[k3]; // Error
226-
>x[k3] : (T | U)[keyof T | keyof U]
226+
>x[k3] : any
227227
>x : T | U
228228
>k3 : keyof T | keyof U
229229

230230
x[k4]; // Error
231-
>x[k4] : (T | U)[keyof T | keyof U]
231+
>x[k4] : any
232232
>x : T | U
233233
>k4 : keyof T | keyof U
234234

tests/baselines/reference/mappedTypeErrors2.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
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; }'.
43
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
54
Type 'AB[S]' is not assignable to type 'symbol'.
65
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2536: Type 'S' cannot be used to index type 'AB'.
76
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(17,49): error TS2536: Type 'L' cannot be used to index type '{ [key in AB[S]]: true; }'.
87

98

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

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

2928
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; }'.
3229
~~~~~
3330
!!! error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
3431
!!! error TS2322: Type 'AB[S]' is not assignable to type 'symbol'.

tests/baselines/reference/mappedTypeRelationships.errors.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(11,5): error TS2
33
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(16,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
44
Type 'T' is not assignable to type 'U'.
55
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(20,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
6-
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,5): error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'.
7-
Type 'T' is not assignable to type 'U'.
86
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
97
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(25,5): error TS2536: Type 'K' cannot be used to index type 'T'.
10-
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
11-
Type 'T' is not assignable to type 'U'.
128
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,12): error TS2536: Type 'K' cannot be used to index type 'T'.
139
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(30,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
1410
Type 'undefined' is not assignable to type 'T[keyof T]'.
@@ -60,7 +56,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
6056
Type 'T' is not assignable to type 'U'.
6157

6258

63-
==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (30 errors) ====
59+
==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (28 errors) ====
6460
function f1<T>(x: T, k: keyof T) {
6561
return x[k];
6662
}
@@ -90,9 +86,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
9086
~~~~
9187
!!! error TS2536: Type 'keyof U' cannot be used to index type 'T'.
9288
y[k] = x[k]; // Error
93-
~~~~
94-
!!! error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'.
95-
!!! error TS2322: Type 'T' is not assignable to type 'U'.
9689
~~~~
9790
!!! error TS2536: Type 'keyof U' cannot be used to index type 'T'.
9891
}
@@ -102,9 +95,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
10295
~~~~
10396
!!! error TS2536: Type 'K' cannot be used to index type 'T'.
10497
y[k] = x[k]; // Error
105-
~~~~
106-
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
107-
!!! error TS2322: Type 'T' is not assignable to type 'U'.
10898
~~~~
10999
!!! error TS2536: Type 'K' cannot be used to index type 'T'.
110100
}

tests/baselines/reference/mappedTypeRelationships.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ function f5<T, U extends T>(x: T, y: U, k: keyof U) {
7979

8080
x[k] = y[k]; // Error
8181
>x[k] = y[k] : U[keyof U]
82-
>x[k] : T[keyof U]
82+
>x[k] : any
8383
>x : T
8484
>k : keyof U
8585
>y[k] : U[keyof U]
8686
>y : U
8787
>k : keyof U
8888

8989
y[k] = x[k]; // Error
90-
>y[k] = x[k] : T[keyof U]
90+
>y[k] = x[k] : any
9191
>y[k] : U[keyof U]
9292
>y : U
9393
>k : keyof U
94-
>x[k] : T[keyof U]
94+
>x[k] : any
9595
>x : T
9696
>k : keyof U
9797
}
@@ -104,19 +104,19 @@ function f6<T, U extends T, K extends keyof U>(x: T, y: U, k: K) {
104104

105105
x[k] = y[k]; // Error
106106
>x[k] = y[k] : U[K]
107-
>x[k] : T[K]
107+
>x[k] : any
108108
>x : T
109109
>k : K
110110
>y[k] : U[K]
111111
>y : U
112112
>k : K
113113

114114
y[k] = x[k]; // Error
115-
>y[k] = x[k] : T[K]
115+
>y[k] = x[k] : any
116116
>y[k] : U[K]
117117
>y : U
118118
>k : K
119-
>x[k] : T[K]
119+
>x[k] : any
120120
>x : T
121121
>k : K
122122
}

tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
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]'.
66
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'.
710
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["toString"]'.
13+
Type 'string' is not assignable to type '() => string'.
814
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(24,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
915
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(27,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
16+
Type 'string' is not assignable to type 'T["a"]'.
17+
Type 'string' is not assignable to type 'number'.
1018
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(30,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
19+
Type 'string' is not assignable to type 'T[string] & T[number]'.
20+
Type 'string' is not assignable to type 'T[string]'.
21+
Type 'string' is not assignable to type 'number'.
1122

1223

1324
==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ====
@@ -41,11 +52,17 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
4152
tp = s;
4253
~~
4354
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
55+
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"] & T["toFixed"] & T["toExponential"] & T["toPrecision"] & T["valueOf"] & T["toLocaleString"]'.
56+
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"]'.
57+
!!! error TS2322: Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
4458
}
4559
function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
4660
tp = s;
4761
~~
4862
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
63+
!!! 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'.
4966
}
5067
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
5168
tp = s;
@@ -56,10 +73,15 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
5673
tp = s;
5774
~~
5875
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
76+
!!! error TS2322: Type 'string' is not assignable to type 'T["a"]'.
77+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
5978
}
6079
function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
6180
tp = s;
6281
~~
6382
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
83+
!!! error TS2322: Type 'string' is not assignable to type 'T[string] & T[number]'.
84+
!!! error TS2322: Type 'string' is not assignable to type 'T[string]'.
85+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
6486
}
6587

0 commit comments

Comments
 (0)