Skip to content

Commit 64174b9

Browse files
committed
Accept new baselines
1 parent bbce336 commit 64174b9

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

tests/baselines/reference/keyofAndIndexedAccess2.errors.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23
208208
// Repro from #31149
209209

210210
function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
211-
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
211+
cb(param[0]);
212+
}
213+
214+
function fn4<K extends number>() {
215+
let x: Array<string>[K] = 'abc';
216+
let y: ReadonlyArray<string>[K] = 'abc';
212217
}
213218

tests/baselines/reference/keyofAndIndexedAccess2.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ function fn2<T extends Array<string>>(param: T, cb: (element: T[number]) => void
129129
// Repro from #31149
130130

131131
function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number]) => void) {
132-
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
132+
cb(param[0]);
133+
}
134+
135+
function fn4<K extends number>() {
136+
let x: Array<string>[K] = 'abc';
137+
let y: ReadonlyArray<string>[K] = 'abc';
133138
}
134139

135140

@@ -215,5 +220,9 @@ function fn2(param, cb) {
215220
}
216221
// Repro from #31149
217222
function fn3(param, cb) {
218-
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
223+
cb(param[0]);
224+
}
225+
function fn4() {
226+
let x = 'abc';
227+
let y = 'abc';
219228
}

tests/baselines/reference/keyofAndIndexedAccess2.symbols

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,23 @@ function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number])
483483
>element : Symbol(element, Decl(keyofAndIndexedAccess2.ts, 129, 61))
484484
>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 129, 13))
485485

486-
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
486+
cb(param[0]);
487487
>cb : Symbol(cb, Decl(keyofAndIndexedAccess2.ts, 129, 55))
488488
>param : Symbol(param, Decl(keyofAndIndexedAccess2.ts, 129, 46))
489489
}
490490

491+
function fn4<K extends number>() {
492+
>fn4 : Symbol(fn4, Decl(keyofAndIndexedAccess2.ts, 131, 1))
493+
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))
494+
495+
let x: Array<string>[K] = 'abc';
496+
>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 134, 7))
497+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 2 more)
498+
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))
499+
500+
let y: ReadonlyArray<string>[K] = 'abc';
501+
>y : Symbol(y, Decl(keyofAndIndexedAccess2.ts, 135, 7))
502+
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es2019.array.d.ts, --, --))
503+
>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13))
504+
}
505+

tests/baselines/reference/keyofAndIndexedAccess2.types

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,23 @@ function fn3<T extends ReadonlyArray<string>>(param: T, cb: (element: T[number])
479479
>cb : (element: T[number]) => void
480480
>element : T[number]
481481

482-
cb(param[0]); // Argument of type 'string' is not assignable to parameter of type 'T[number]'.
482+
cb(param[0]);
483483
>cb(param[0]) : void
484484
>cb : (element: T[number]) => void
485485
>param[0] : string
486486
>param : T
487487
>0 : 0
488488
}
489489

490+
function fn4<K extends number>() {
491+
>fn4 : <K extends number>() => void
492+
493+
let x: Array<string>[K] = 'abc';
494+
>x : string[][K]
495+
>'abc' : "abc"
496+
497+
let y: ReadonlyArray<string>[K] = 'abc';
498+
>y : readonly string[][K]
499+
>'abc' : "abc"
500+
}
501+

0 commit comments

Comments
 (0)