File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
packages/vite-plugin-monkey/src/client/types Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,25 @@ export interface GmAsyncGetValueType {
7
7
}
8
8
9
9
export interface GmGetValuesType {
10
- ( keys : string [ ] ) : any [ ] ;
11
- ( keyValues : Record < string , any > ) : any [ ] ;
10
+ < T extends Record < string , any > > ( ) : T ;
11
+ /**
12
+ * @example
13
+ * const values1 = GM_getValues(['key1', 'key2']); // { key1: any; key2: any }
14
+ * const values2 = GM_getValues<{ key1: string; key2: number }>(['key1', 'key2']);
15
+ */
16
+ < T extends Record < string , any > > ( keys : ( keyof T ) [ ] ) : T ;
17
+ < T extends Record < string , any > > ( keyValues : T ) : T ;
12
18
}
13
19
14
20
export interface GmAsyncGetValuesType {
15
- ( keys : string [ ] ) : Promise < any [ ] > ;
16
- ( keyValues : Record < string , any > ) : Promise < any [ ] > ;
21
+ < T extends Record < string , any > > ( ) : Promise < T > ;
22
+ /**
23
+ * @example
24
+ * const values1 = await GM.getValues(['key1', 'key2']); // { key1: any; key2: any }
25
+ * const values2 = await GM.getValues<{ key1: string; key2: number }>(['key1', 'key2']);
26
+ */
27
+ < T extends Record < string , any > > ( keys : ( keyof T ) [ ] ) : Promise < T > ;
28
+ < T extends Record < string , any > > ( keyValues : T ) : Promise < T > ;
17
29
}
18
30
19
31
export interface GmSetValueType {
You can’t perform that action at this time.
0 commit comments