diff --git a/types/node/cluster.d.ts b/types/node/cluster.d.ts index 1a16701f964dbd..cdbc21902c2b77 100644 --- a/types/node/cluster.d.ts +++ b/types/node/cluster.d.ts @@ -72,7 +72,7 @@ declare module "cluster" { * String arguments passed to worker. * @default process.argv.slice(2) */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Whether or not to send output to parent's stdio. * @default false diff --git a/types/node/util.d.ts b/types/node/util.d.ts index 287952a5853f35..9a01b35b0fc066 100644 --- a/types/node/util.d.ts +++ b/types/node/util.d.ts @@ -1442,7 +1442,7 @@ declare module "util" { /** * Array of argument strings. */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Used to describe arguments known to the parser. */ diff --git a/types/node/v20/cluster.d.ts b/types/node/v20/cluster.d.ts index 88e8d967bddbea..42b21bfb113a40 100644 --- a/types/node/v20/cluster.d.ts +++ b/types/node/v20/cluster.d.ts @@ -72,7 +72,7 @@ declare module "cluster" { * String arguments passed to worker. * @default process.argv.slice(2) */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Whether or not to send output to parent's stdio. * @default false diff --git a/types/node/v20/util.d.ts b/types/node/v20/util.d.ts index 3e8989310964b4..1c564c0af313eb 100644 --- a/types/node/v20/util.d.ts +++ b/types/node/v20/util.d.ts @@ -1478,7 +1478,7 @@ declare module "util" { /** * Array of argument strings. */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Used to describe arguments known to the parser. */ diff --git a/types/node/v20/wasi.d.ts b/types/node/v20/wasi.d.ts index fbf29ac261c851..634b62c974ef48 100644 --- a/types/node/v20/wasi.d.ts +++ b/types/node/v20/wasi.d.ts @@ -77,7 +77,7 @@ declare module "wasi" { * WASI command itself. * @default [] */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * An object similar to `process.env` that the WebAssembly * application will see as its environment. diff --git a/types/node/v22/cluster.d.ts b/types/node/v22/cluster.d.ts index 156c91d675cdec..eab9783aa4f507 100644 --- a/types/node/v22/cluster.d.ts +++ b/types/node/v22/cluster.d.ts @@ -72,7 +72,7 @@ declare module "cluster" { * String arguments passed to worker. * @default process.argv.slice(2) */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Whether or not to send output to parent's stdio. * @default false diff --git a/types/node/v22/util.d.ts b/types/node/v22/util.d.ts index 68c624dbe9987e..b6dedb4ebd3d0c 100644 --- a/types/node/v22/util.d.ts +++ b/types/node/v22/util.d.ts @@ -1724,7 +1724,7 @@ declare module "util" { /** * Array of argument strings. */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * Used to describe arguments known to the parser. */ diff --git a/types/node/v22/wasi.d.ts b/types/node/v22/wasi.d.ts index fcbe3975345864..0e92cac0355c83 100644 --- a/types/node/v22/wasi.d.ts +++ b/types/node/v22/wasi.d.ts @@ -77,7 +77,7 @@ declare module "wasi" { * WASI command itself. * @default [] */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * An object similar to `process.env` that the WebAssembly * application will see as its environment. diff --git a/types/node/wasi.d.ts b/types/node/wasi.d.ts index 150ad9035aad41..7685c1e951187c 100644 --- a/types/node/wasi.d.ts +++ b/types/node/wasi.d.ts @@ -77,7 +77,7 @@ declare module "wasi" { * WASI command itself. * @default [] */ - args?: string[] | undefined; + args?: readonly string[] | undefined; /** * An object similar to `process.env` that the WebAssembly * application will see as its environment. diff --git a/types/tampermonkey/index.d.ts b/types/tampermonkey/index.d.ts index ff7fb5e17d614f..bc5a9b3b31aa41 100644 --- a/types/tampermonkey/index.d.ts +++ b/types/tampermonkey/index.d.ts @@ -199,6 +199,8 @@ declare namespace Tampermonkey { abort(): TReturn; } + type PromiseWithAbort = Promise & AbortHandle; + interface OpenTabOptions { /** A boolean value indicating whether the new tab should be active (selected) or not (default is `false`). */ active?: boolean; @@ -1125,7 +1127,7 @@ declare var GM: Readonly<{ xmlHttpRequest( // onload and the like still work details: Tampermonkey.Request, // eslint-disable-line @definitelytyped/no-unnecessary-generics - ): Promise>; + ): Tampermonkey.PromiseWithAbort>; // GM_download has two signatures, GM.download has one /** diff --git a/types/tampermonkey/package.json b/types/tampermonkey/package.json index 47a57b6c687fad..e6135d3f1e4d07 100644 --- a/types/tampermonkey/package.json +++ b/types/tampermonkey/package.json @@ -26,6 +26,10 @@ { "name": "double-beep", "githubUsername": "double-beep" + }, + { + "name": "ziuchen", + "githubUsername": "ziuchen" } ] } diff --git a/types/tampermonkey/tampermonkey-tests.ts b/types/tampermonkey/tampermonkey-tests.ts index eb739b8020fc0e..c8a2fd620a538a 100644 --- a/types/tampermonkey/tampermonkey-tests.ts +++ b/types/tampermonkey/tampermonkey-tests.ts @@ -658,6 +658,15 @@ unsafeWindow.GM; // $ExpectType string minResponse.responseText; + // Test abort method on promise + const abortableRequest = GM.xmlHttpRequest({ + url: "https://github.com/", + method: "GET", + }); + // $ExpectType void + abortableRequest.abort(); + const abortedResponse = await abortableRequest; + // GET request await GM.xmlHttpRequest({ method: "GET",