Skip to content

Commit 6c2f001

Browse files
committed
fix: fix overloaded types for GM.*
close #8
1 parent e35e29d commit 6c2f001

File tree

1 file changed

+40
-41
lines changed

1 file changed

+40
-41
lines changed

index.d.ts

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ declare type GenericObject = Record<string, unknown>;
1313

1414
declare interface VMScriptGMInfoPlatform {
1515
arch:
16-
| 'aarch64'
17-
| 'arm'
18-
| 'arm64'
19-
| 'mips'
20-
| 'mips64'
21-
| 'ppc64'
22-
| 's390x'
23-
| 'sparc64'
24-
| 'x86-32'
25-
| 'x86-64';
16+
| 'aarch64'
17+
| 'arm'
18+
| 'arm64'
19+
| 'mips'
20+
| 'mips64'
21+
| 'ppc64'
22+
| 's390x'
23+
| 'sparc64'
24+
| 'x86-32'
25+
| 'x86-64';
2626
browserName: 'chrome' | 'firefox' | string;
2727
browserVersion: string;
2828
/**
@@ -127,13 +127,13 @@ declare interface VMScriptGMInfoObject {
127127
* @since VM2.20.2
128128
*/
129129
userAgentData?:
130-
| {
131-
brands: { brand: string; version: string }[];
132-
mobile: boolean;
133-
platform: string;
134-
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
135-
}
136-
| undefined;
130+
| {
131+
brands: { brand: string; version: string }[];
132+
mobile: boolean;
133+
platform: string;
134+
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
135+
}
136+
| undefined;
137137
}
138138

139139
/**
@@ -295,15 +295,15 @@ declare function GM_registerMenuCommand(
295295
/** @since VM2.15.9 */
296296
options?:
297297
| {
298-
/** Default: the `caption` parameter.
299-
* In 2.15.9-2.16.1 the default was a randomly generated string. */
300-
id?: string | undefined;
301-
/** A hint shown in the status bar when hovering the command. */
302-
title?: string | undefined;
303-
/** Default: `true`.
304-
* Whether to auto-close the popup after the user invoked the command. */
305-
autoClose?: boolean | undefined;
306-
}
298+
/** Default: the `caption` parameter.
299+
* In 2.15.9-2.16.1 the default was a randomly generated string. */
300+
id?: string | undefined;
301+
/** A hint shown in the status bar when hovering the command. */
302+
title?: string | undefined;
303+
/** Default: `true`.
304+
* Whether to auto-close the popup after the user invoked the command. */
305+
autoClose?: boolean | undefined;
306+
}
307307
| undefined,
308308
): string;
309309
/** Unregisters a command which has been registered to Violentmonkey popup menu. */
@@ -480,15 +480,15 @@ declare interface VMScriptGMXHRDetails<T> extends GMRequestBase<T> {
480480
responseType?: VMScriptResponseType | undefined;
481481
/** Data to send with the request, usually for `POST` and `PUT` requests. */
482482
data?:
483-
| string
484-
| ArrayBuffer
485-
| Blob
486-
| DataView
487-
| FormData
488-
| ReadableStream
489-
| TypedArray
490-
| URLSearchParams
491-
| undefined;
483+
| string
484+
| ArrayBuffer
485+
| Blob
486+
| DataView
487+
| FormData
488+
| ReadableStream
489+
| TypedArray
490+
| URLSearchParams
491+
| undefined;
492492
/** Send the `data` string as a `blob`. This is for compatibility with Tampermonkey/Greasemonkey, where only `string` type is allowed in `data`. */
493493
binary?: boolean | undefined;
494494
}
@@ -519,14 +519,13 @@ declare interface VMScriptGMObjectVMExtensions {
519519
addValueChangeListener: typeof GM_addValueChangeListener;
520520
/** @since VM2.19.1 */
521521
deleteValues: (names: string[]) => Promise<void>;
522-
download:
523-
| ((options: VMScriptGMDownloadOptions) => Promise<Blob> | void)
524-
| ((url: string, name: string) => Promise<Blob> | void);
522+
download(options: VMScriptGMDownloadOptions): Promise<Blob> | void;
523+
download(url: string, name: string): Promise<Blob> | void;
525524
getResourceText: typeof GM_getResourceText;
526525
/** @since VM2.19.1 */
527-
getValues:
528-
| ((names: string[]) => Promise<GenericObject>)
529-
| ((namesWithDefaults: GenericObject) => Promise<GenericObject>);
526+
getValues(names: string[]): Promise<GenericObject>;
527+
/** @since VM2.19.1 */
528+
getValues(namesWithDefaults: GenericObject): Promise<GenericObject>;
530529
log: typeof GM_log;
531530
removeValueChangeListener: typeof GM_removeValueChangeListener;
532531
/** @since VM2.19.1 */

0 commit comments

Comments
 (0)