@@ -21,10 +21,12 @@ type MaybeInstrumentedDriver = Driver & {
21
21
__sentry_instrumented__ ?: boolean ;
22
22
} ;
23
23
24
+ type DriverMethod = keyof Driver ;
25
+
24
26
/**
25
27
* Methods that should have a key argument.
26
28
*/
27
- const KEYED_METHODS = new Set ( [
29
+ const KEYED_METHODS = new Set < DriverMethod > ( [
28
30
'hasItem' ,
29
31
'getItem' ,
30
32
'getItemRaw' ,
@@ -38,7 +40,7 @@ const KEYED_METHODS = new Set([
38
40
/**
39
41
* Methods that should have a attribute to indicate a cache hit.
40
42
*/
41
- const CACHE_HIT_METHODS = new Set ( [ 'hasItem' , 'getItem' , 'getKeys' ] ) ;
43
+ const CACHE_HIT_METHODS = new Set < DriverMethod > ( [ 'hasItem' , 'getItem' , 'getItemRaw ', 'getKeys' ] ) ;
42
44
43
45
/**
44
46
* Creates a Nitro plugin that instruments the storage driver.
@@ -85,7 +87,7 @@ function instrumentDriver(driver: MaybeInstrumentedDriver, mountBase: string): D
85
87
86
88
// List of driver methods to instrument
87
89
// get/set/remove are aliases and already use their {method}Item methods
88
- const methodsToInstrument : ( keyof Driver ) [ ] = [
90
+ const methodsToInstrument : DriverMethod [ ] = [
89
91
'hasItem' ,
90
92
'getItem' ,
91
93
'getItemRaw' ,
@@ -120,7 +122,7 @@ function instrumentDriver(driver: MaybeInstrumentedDriver, mountBase: string): D
120
122
*/
121
123
function createMethodWrapper (
122
124
original : ( ...args : unknown [ ] ) => unknown ,
123
- methodName : string ,
125
+ methodName : DriverMethod ,
124
126
driver : Driver ,
125
127
mountBase : string ,
126
128
) : ( ...args : unknown [ ] ) => unknown {
0 commit comments