@@ -227,8 +227,10 @@ function createReadonlyMethod(type: TriggerOpTypes): Function {
227
227
}
228
228
}
229
229
230
+ type Instrumentations = Record < string | symbol , Function | number >
231
+
230
232
function createInstrumentations ( ) {
231
- const mutableInstrumentations : Record < string , Function | number > = {
233
+ const mutableInstrumentations : Instrumentations = {
232
234
get ( this : MapTypes , key : unknown ) {
233
235
return get ( this , key )
234
236
} ,
@@ -243,7 +245,7 @@ function createInstrumentations() {
243
245
forEach : createForEach ( false , false )
244
246
}
245
247
246
- const shallowInstrumentations : Record < string , Function | number > = {
248
+ const shallowInstrumentations : Instrumentations = {
247
249
get ( this : MapTypes , key : unknown ) {
248
250
return get ( this , key , false , true )
249
251
} ,
@@ -258,7 +260,7 @@ function createInstrumentations() {
258
260
forEach : createForEach ( false , true )
259
261
}
260
262
261
- const readonlyInstrumentations : Record < string , Function | number > = {
263
+ const readonlyInstrumentations : Instrumentations = {
262
264
get ( this : MapTypes , key : unknown ) {
263
265
return get ( this , key , true )
264
266
} ,
@@ -275,7 +277,7 @@ function createInstrumentations() {
275
277
forEach : createForEach ( true , false )
276
278
}
277
279
278
- const shallowReadonlyInstrumentations : Record < string , Function | number > = {
280
+ const shallowReadonlyInstrumentations : Instrumentations = {
279
281
get ( this : MapTypes , key : unknown ) {
280
282
return get ( this , key , true , true )
281
283
} ,
@@ -292,24 +294,18 @@ function createInstrumentations() {
292
294
forEach : createForEach ( true , true )
293
295
}
294
296
295
- const iteratorMethods = [ 'keys' , 'values' , 'entries' , Symbol . iterator ]
297
+ const iteratorMethods = [
298
+ 'keys' ,
299
+ 'values' ,
300
+ 'entries' ,
301
+ Symbol . iterator
302
+ ] as const
303
+
296
304
iteratorMethods . forEach ( method => {
297
- mutableInstrumentations [ method as string ] = createIterableMethod (
298
- method ,
299
- false ,
300
- false
301
- )
302
- readonlyInstrumentations [ method as string ] = createIterableMethod (
303
- method ,
304
- true ,
305
- false
306
- )
307
- shallowInstrumentations [ method as string ] = createIterableMethod (
308
- method ,
309
- false ,
310
- true
311
- )
312
- shallowReadonlyInstrumentations [ method as string ] = createIterableMethod (
305
+ mutableInstrumentations [ method ] = createIterableMethod ( method , false , false )
306
+ readonlyInstrumentations [ method ] = createIterableMethod ( method , true , false )
307
+ shallowInstrumentations [ method ] = createIterableMethod ( method , false , true )
308
+ shallowReadonlyInstrumentations [ method ] = createIterableMethod (
313
309
method ,
314
310
true ,
315
311
true
0 commit comments