@@ -237,8 +237,10 @@ function createReadonlyMethod(type: TriggerOpTypes): Function {
237
237
}
238
238
}
239
239
240
+ type Instrumentations = Record < string | symbol , Function | number >
241
+
240
242
function createInstrumentations ( ) {
241
- const mutableInstrumentations : Record < string , Function | number > = {
243
+ const mutableInstrumentations : Instrumentations = {
242
244
get ( this : MapTypes , key : unknown ) {
243
245
return get ( this , key )
244
246
} ,
@@ -253,7 +255,7 @@ function createInstrumentations() {
253
255
forEach : createForEach ( false , false ) ,
254
256
}
255
257
256
- const shallowInstrumentations : Record < string , Function | number > = {
258
+ const shallowInstrumentations : Instrumentations = {
257
259
get ( this : MapTypes , key : unknown ) {
258
260
return get ( this , key , false , true )
259
261
} ,
@@ -268,7 +270,7 @@ function createInstrumentations() {
268
270
forEach : createForEach ( false , true ) ,
269
271
}
270
272
271
- const readonlyInstrumentations : Record < string , Function | number > = {
273
+ const readonlyInstrumentations : Instrumentations = {
272
274
get ( this : MapTypes , key : unknown ) {
273
275
return get ( this , key , true )
274
276
} ,
@@ -285,7 +287,7 @@ function createInstrumentations() {
285
287
forEach : createForEach ( true , false ) ,
286
288
}
287
289
288
- const shallowReadonlyInstrumentations : Record < string , Function | number > = {
290
+ const shallowReadonlyInstrumentations : Instrumentations = {
289
291
get ( this : MapTypes , key : unknown ) {
290
292
return get ( this , key , true , true )
291
293
} ,
@@ -302,24 +304,18 @@ function createInstrumentations() {
302
304
forEach : createForEach ( true , true ) ,
303
305
}
304
306
305
- const iteratorMethods = [ 'keys' , 'values' , 'entries' , Symbol . iterator ]
307
+ const iteratorMethods = [
308
+ 'keys' ,
309
+ 'values' ,
310
+ 'entries' ,
311
+ Symbol . iterator ,
312
+ ] as const
313
+
306
314
iteratorMethods . forEach ( method => {
307
- mutableInstrumentations [ method as string ] = createIterableMethod (
308
- method ,
309
- false ,
310
- false ,
311
- )
312
- readonlyInstrumentations [ method as string ] = createIterableMethod (
313
- method ,
314
- true ,
315
- false ,
316
- )
317
- shallowInstrumentations [ method as string ] = createIterableMethod (
318
- method ,
319
- false ,
320
- true ,
321
- )
322
- shallowReadonlyInstrumentations [ method as string ] = createIterableMethod (
315
+ mutableInstrumentations [ method ] = createIterableMethod ( method , false , false )
316
+ readonlyInstrumentations [ method ] = createIterableMethod ( method , true , false )
317
+ shallowInstrumentations [ method ] = createIterableMethod ( method , false , true )
318
+ shallowReadonlyInstrumentations [ method ] = createIterableMethod (
323
319
method ,
324
320
true ,
325
321
true ,
0 commit comments