Skip to content

Commit 4304e0d

Browse files
committed
add missing test, oops
1 parent d06df2f commit 4304e0d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @strict: true
2+
// @noUncheckedIndexedAccess: true
3+
// @noEmit: true
4+
5+
// https://github.com/microsoft/TypeScript/issues/61389
6+
7+
const arr: number[] = [1, 2, 3];
8+
const idx: number = 2;
9+
if (idx in arr) {
10+
const x: number = arr[idx]; // ok
11+
}
12+
13+
const map: Record<string, number> = { a: 1 };
14+
const key: string = "a";
15+
if (key in map) {
16+
const x: number = map[key]; // ok
17+
}

0 commit comments

Comments
 (0)