File: noUncheckedIndexedAccess.symbols

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (358 lines) | stat: -rw-r--r-- 17,506 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
=== tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts ===
type CheckBooleanOnly<T extends boolean> = any;
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 0, 22))

// Validate CheckBooleanOnly works - should error
type T_ERR1 = CheckBooleanOnly<boolean | undefined>;
>T_ERR1 : Symbol(T_ERR1, Decl(noUncheckedIndexedAccess.ts, 0, 47))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))

enum NumericEnum1 { A, B, C }
>NumericEnum1 : Symbol(NumericEnum1, Decl(noUncheckedIndexedAccess.ts, 2, 52))
>A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))
>B : Symbol(NumericEnum1.B, Decl(noUncheckedIndexedAccess.ts, 4, 22))
>C : Symbol(NumericEnum1.C, Decl(noUncheckedIndexedAccess.ts, 4, 25))

enum NumericEnum2 { A = 0, B = 1 , C = 2 }
>NumericEnum2 : Symbol(NumericEnum2, Decl(noUncheckedIndexedAccess.ts, 4, 29))
>A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))
>B : Symbol(NumericEnum2.B, Decl(noUncheckedIndexedAccess.ts, 5, 26))
>C : Symbol(NumericEnum2.C, Decl(noUncheckedIndexedAccess.ts, 5, 34))

enum StringEnum1 { A = "Alpha", B = "Beta" }
>StringEnum1 : Symbol(StringEnum1, Decl(noUncheckedIndexedAccess.ts, 5, 42))
>A : Symbol(StringEnum1.A, Decl(noUncheckedIndexedAccess.ts, 6, 18))
>B : Symbol(StringEnum1.B, Decl(noUncheckedIndexedAccess.ts, 6, 31))

declare const strMap: { [s: string]: boolean };
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 8, 25))

// All of these should be errors
const e1: boolean = strMap["foo"];
>e1 : Symbol(e1, Decl(noUncheckedIndexedAccess.ts, 11, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e2: boolean = strMap.bar;
>e2 : Symbol(e2, Decl(noUncheckedIndexedAccess.ts, 12, 5))
>strMap.bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))

const e3: boolean = strMap[0];
>e3 : Symbol(e3, Decl(noUncheckedIndexedAccess.ts, 13, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e4: boolean = strMap[0 as string | number];
>e4 : Symbol(e4, Decl(noUncheckedIndexedAccess.ts, 14, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e5: boolean = strMap[0 as string | 0 | 1];
>e5 : Symbol(e5, Decl(noUncheckedIndexedAccess.ts, 15, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e6: boolean = strMap[0 as 0 | 1];
>e6 : Symbol(e6, Decl(noUncheckedIndexedAccess.ts, 16, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e7: boolean = strMap["foo" as "foo" | "baz"];
>e7 : Symbol(e7, Decl(noUncheckedIndexedAccess.ts, 17, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const e8: boolean = strMap[NumericEnum1.A];
>e8 : Symbol(e8, Decl(noUncheckedIndexedAccess.ts, 18, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>NumericEnum1.A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))
>NumericEnum1 : Symbol(NumericEnum1, Decl(noUncheckedIndexedAccess.ts, 2, 52))
>A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))

const e9: boolean = strMap[NumericEnum2.A];
>e9 : Symbol(e9, Decl(noUncheckedIndexedAccess.ts, 19, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>NumericEnum2.A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))
>NumericEnum2 : Symbol(NumericEnum2, Decl(noUncheckedIndexedAccess.ts, 4, 29))
>A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))

const e10: boolean = strMap[StringEnum1.A];
>e10 : Symbol(e10, Decl(noUncheckedIndexedAccess.ts, 20, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>StringEnum1.A : Symbol(StringEnum1.A, Decl(noUncheckedIndexedAccess.ts, 6, 18))
>StringEnum1 : Symbol(StringEnum1, Decl(noUncheckedIndexedAccess.ts, 5, 42))
>A : Symbol(StringEnum1.A, Decl(noUncheckedIndexedAccess.ts, 6, 18))

const e11: boolean = strMap[StringEnum1.A as StringEnum1];
>e11 : Symbol(e11, Decl(noUncheckedIndexedAccess.ts, 21, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>StringEnum1.A : Symbol(StringEnum1.A, Decl(noUncheckedIndexedAccess.ts, 6, 18))
>StringEnum1 : Symbol(StringEnum1, Decl(noUncheckedIndexedAccess.ts, 5, 42))
>A : Symbol(StringEnum1.A, Decl(noUncheckedIndexedAccess.ts, 6, 18))
>StringEnum1 : Symbol(StringEnum1, Decl(noUncheckedIndexedAccess.ts, 5, 42))

const e12: boolean = strMap[NumericEnum1.A as NumericEnum1];
>e12 : Symbol(e12, Decl(noUncheckedIndexedAccess.ts, 22, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>NumericEnum1.A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))
>NumericEnum1 : Symbol(NumericEnum1, Decl(noUncheckedIndexedAccess.ts, 2, 52))
>A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))
>NumericEnum1 : Symbol(NumericEnum1, Decl(noUncheckedIndexedAccess.ts, 2, 52))

const e13: boolean = strMap[NumericEnum2.A as NumericEnum2];
>e13 : Symbol(e13, Decl(noUncheckedIndexedAccess.ts, 23, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>NumericEnum2.A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))
>NumericEnum2 : Symbol(NumericEnum2, Decl(noUncheckedIndexedAccess.ts, 4, 29))
>A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))
>NumericEnum2 : Symbol(NumericEnum2, Decl(noUncheckedIndexedAccess.ts, 4, 29))

const e14: boolean = strMap[null as any];
>e14 : Symbol(e14, Decl(noUncheckedIndexedAccess.ts, 24, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

// Should be OK
const ok1: boolean | undefined = strMap["foo"];
>ok1 : Symbol(ok1, Decl(noUncheckedIndexedAccess.ts, 27, 5))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

const ok2: boolean | undefined = strMap.bar;
>ok2 : Symbol(ok2, Decl(noUncheckedIndexedAccess.ts, 28, 5))
>strMap.bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))

type T_OK1 = CheckBooleanOnly<(typeof strMap)[string]>;
>T_OK1 : Symbol(T_OK1, Decl(noUncheckedIndexedAccess.ts, 28, 44))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

type T_OK2 = CheckBooleanOnly<(typeof strMap)["foo"]>;
>T_OK2 : Symbol(T_OK2, Decl(noUncheckedIndexedAccess.ts, 30, 55))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

type T_OK3 = CheckBooleanOnly<(typeof strMap)["bar" | "baz"]>;
>T_OK3 : Symbol(T_OK3, Decl(noUncheckedIndexedAccess.ts, 31, 54))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

type T_OK4 = CheckBooleanOnly<(typeof strMap)[number]>;
>T_OK4 : Symbol(T_OK4, Decl(noUncheckedIndexedAccess.ts, 32, 62))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

type T_OK5 = CheckBooleanOnly<(typeof strMap)[any]>;
>T_OK5 : Symbol(T_OK5, Decl(noUncheckedIndexedAccess.ts, 33, 55))
>CheckBooleanOnly : Symbol(CheckBooleanOnly, Decl(noUncheckedIndexedAccess.ts, 0, 0))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))

// Writes don't allow 'undefined'; all should be errors
strMap["baz"] = undefined;
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>undefined : Symbol(undefined)

strMap.qua = undefined;
>strMap.qua : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>qua : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
>undefined : Symbol(undefined)

strMap[0] = undefined;
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>undefined : Symbol(undefined)

strMap[null as any] = undefined;
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>undefined : Symbol(undefined)

// Numeric lookups are unaffected
declare const numMap: { [s: number]: boolean };
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 43, 25))

// All of these should be ok
const num_ok1: boolean = numMap[0];
>num_ok1 : Symbol(num_ok1, Decl(noUncheckedIndexedAccess.ts, 45, 5))
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))

const num_ok2: boolean = numMap[0 as number];
>num_ok2 : Symbol(num_ok2, Decl(noUncheckedIndexedAccess.ts, 46, 5))
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))

const num_ok3: boolean = numMap[0 as 0 | 1];
>num_ok3 : Symbol(num_ok3, Decl(noUncheckedIndexedAccess.ts, 47, 5))
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))

const num_ok4: boolean = numMap[NumericEnum1.A];
>num_ok4 : Symbol(num_ok4, Decl(noUncheckedIndexedAccess.ts, 48, 5))
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))
>NumericEnum1.A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))
>NumericEnum1 : Symbol(NumericEnum1, Decl(noUncheckedIndexedAccess.ts, 2, 52))
>A : Symbol(NumericEnum1.A, Decl(noUncheckedIndexedAccess.ts, 4, 19))

const num_ok5: boolean = numMap[NumericEnum2.A];
>num_ok5 : Symbol(num_ok5, Decl(noUncheckedIndexedAccess.ts, 49, 5))
>numMap : Symbol(numMap, Decl(noUncheckedIndexedAccess.ts, 43, 13))
>NumericEnum2.A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))
>NumericEnum2 : Symbol(NumericEnum2, Decl(noUncheckedIndexedAccess.ts, 4, 29))
>A : Symbol(NumericEnum2.A, Decl(noUncheckedIndexedAccess.ts, 5, 19))

// Generics
function generic1<T extends { [s: string]: boolean }>(arg: T): boolean {
>generic1 : Symbol(generic1, Decl(noUncheckedIndexedAccess.ts, 49, 48))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 52, 18))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 52, 31))
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 52, 54))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 52, 18))

    // Should error
    return arg["blah"];
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 52, 54))
}
function generic2<T extends { [s: string]: boolean }>(arg: T): boolean {
>generic2 : Symbol(generic2, Decl(noUncheckedIndexedAccess.ts, 55, 1))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 56, 18))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 56, 31))
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 56, 54))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 56, 18))

    // Should OK
    return arg["blah"]!;
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 56, 54))
}
function generic3<T extends string>(arg: T): boolean {
>generic3 : Symbol(generic3, Decl(noUncheckedIndexedAccess.ts, 59, 1))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 60, 18))
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 60, 36))
>T : Symbol(T, Decl(noUncheckedIndexedAccess.ts, 60, 18))

    // Should error
    return strMap[arg];
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
>arg : Symbol(arg, Decl(noUncheckedIndexedAccess.ts, 60, 36))
}

// Element access into known properties is ok
declare const obj1: { x: string, y: number, [key: string]: string | number };
>obj1 : Symbol(obj1, Decl(noUncheckedIndexedAccess.ts, 66, 13))
>x : Symbol(x, Decl(noUncheckedIndexedAccess.ts, 66, 21))
>y : Symbol(y, Decl(noUncheckedIndexedAccess.ts, 66, 32))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 66, 45))

obj1["x"];
>obj1 : Symbol(obj1, Decl(noUncheckedIndexedAccess.ts, 66, 13))
>"x" : Symbol(x, Decl(noUncheckedIndexedAccess.ts, 66, 21))

const y = "y";
>y : Symbol(y, Decl(noUncheckedIndexedAccess.ts, 68, 5))

obj1[y];
>obj1 : Symbol(obj1, Decl(noUncheckedIndexedAccess.ts, 66, 13))
>y : Symbol(y, Decl(noUncheckedIndexedAccess.ts, 68, 5))

let yy = "y";
>yy : Symbol(yy, Decl(noUncheckedIndexedAccess.ts, 70, 3))

obj1[yy];
>obj1 : Symbol(obj1, Decl(noUncheckedIndexedAccess.ts, 66, 13))
>yy : Symbol(yy, Decl(noUncheckedIndexedAccess.ts, 70, 3))

let z = "z";
>z : Symbol(z, Decl(noUncheckedIndexedAccess.ts, 72, 3))

obj1[z];
>obj1 : Symbol(obj1, Decl(noUncheckedIndexedAccess.ts, 66, 13))
>z : Symbol(z, Decl(noUncheckedIndexedAccess.ts, 72, 3))

// Distributivity cases
declare const strMapUnion: { [s: string]: boolean } | { [s: string]: number };
>strMapUnion : Symbol(strMapUnion, Decl(noUncheckedIndexedAccess.ts, 76, 13))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 76, 30))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 76, 57))

// Should error
const f1: boolean | number = strMapUnion["foo"];
>f1 : Symbol(f1, Decl(noUncheckedIndexedAccess.ts, 78, 5))
>strMapUnion : Symbol(strMapUnion, Decl(noUncheckedIndexedAccess.ts, 76, 13))

// Symbol index signatures
declare const s: unique symbol;
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 81, 13))

declare const symbolMap: { [s]: string };
>symbolMap : Symbol(symbolMap, Decl(noUncheckedIndexedAccess.ts, 82, 13))
>[s] : Symbol([s], Decl(noUncheckedIndexedAccess.ts, 82, 26))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 81, 13))

const e15: string = symbolMap[s]; // Should OK
>e15 : Symbol(e15, Decl(noUncheckedIndexedAccess.ts, 83, 5))
>symbolMap : Symbol(symbolMap, Decl(noUncheckedIndexedAccess.ts, 82, 13))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 81, 13))

symbolMap[s] = undefined; // Should error
>symbolMap : Symbol(symbolMap, Decl(noUncheckedIndexedAccess.ts, 82, 13))
>s : Symbol(s, Decl(noUncheckedIndexedAccess.ts, 81, 13))
>undefined : Symbol(undefined)

// Variadic tuples
declare const nonEmptyStringArray: [string, ...string[]];
>nonEmptyStringArray : Symbol(nonEmptyStringArray, Decl(noUncheckedIndexedAccess.ts, 87, 13))

const variadicOk1: string = nonEmptyStringArray[0];  // Should OK
>variadicOk1 : Symbol(variadicOk1, Decl(noUncheckedIndexedAccess.ts, 88, 5))
>nonEmptyStringArray : Symbol(nonEmptyStringArray, Decl(noUncheckedIndexedAccess.ts, 87, 13))
>0 : Symbol(0)

const variadicError1: string = nonEmptyStringArray[1]; // Should error
>variadicError1 : Symbol(variadicError1, Decl(noUncheckedIndexedAccess.ts, 89, 5))
>nonEmptyStringArray : Symbol(nonEmptyStringArray, Decl(noUncheckedIndexedAccess.ts, 87, 13))

// Generic index type
declare const myRecord1: { a: string; b: string };
>myRecord1 : Symbol(myRecord1, Decl(noUncheckedIndexedAccess.ts, 92, 13))
>a : Symbol(a, Decl(noUncheckedIndexedAccess.ts, 92, 26))
>b : Symbol(b, Decl(noUncheckedIndexedAccess.ts, 92, 37))

declare const myRecord2: { a: string; b: string, [key: string]: string };
>myRecord2 : Symbol(myRecord2, Decl(noUncheckedIndexedAccess.ts, 93, 13))
>a : Symbol(a, Decl(noUncheckedIndexedAccess.ts, 93, 26))
>b : Symbol(b, Decl(noUncheckedIndexedAccess.ts, 93, 37))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 93, 50))

const fn1 = <Key extends keyof typeof myRecord1>(key: Key): string => myRecord1[key]; // Should OK
>fn1 : Symbol(fn1, Decl(noUncheckedIndexedAccess.ts, 94, 5))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 94, 13))
>myRecord1 : Symbol(myRecord1, Decl(noUncheckedIndexedAccess.ts, 92, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 94, 49))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 94, 13))
>myRecord1 : Symbol(myRecord1, Decl(noUncheckedIndexedAccess.ts, 92, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 94, 49))

const fn2 = <Key extends keyof typeof myRecord1>(key: Key): string => myRecord2[key]; // Should OK
>fn2 : Symbol(fn2, Decl(noUncheckedIndexedAccess.ts, 95, 5))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 95, 13))
>myRecord1 : Symbol(myRecord1, Decl(noUncheckedIndexedAccess.ts, 92, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 95, 49))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 95, 13))
>myRecord2 : Symbol(myRecord2, Decl(noUncheckedIndexedAccess.ts, 93, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 95, 49))

const fn3 = <Key extends keyof typeof myRecord2>(key: Key) => {
>fn3 : Symbol(fn3, Decl(noUncheckedIndexedAccess.ts, 96, 5))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 96, 13))
>myRecord2 : Symbol(myRecord2, Decl(noUncheckedIndexedAccess.ts, 93, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 96, 49))
>Key : Symbol(Key, Decl(noUncheckedIndexedAccess.ts, 96, 13))

    myRecord2[key] = undefined; // Should error
>myRecord2 : Symbol(myRecord2, Decl(noUncheckedIndexedAccess.ts, 93, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 96, 49))
>undefined : Symbol(undefined)

    const v: string = myRecord2[key]; // Should error
>v : Symbol(v, Decl(noUncheckedIndexedAccess.ts, 98, 9))
>myRecord2 : Symbol(myRecord2, Decl(noUncheckedIndexedAccess.ts, 93, 13))
>key : Symbol(key, Decl(noUncheckedIndexedAccess.ts, 96, 49))

};