Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/node/cluster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion types/node/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/node/v20/cluster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion types/node/v20/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/node/v20/wasi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion types/node/v22/cluster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion types/node/v22/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/node/v22/wasi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion types/node/wasi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion types/tampermonkey/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ declare namespace Tampermonkey {
abort(): TReturn;
}

type PromiseWithAbort<T> = Promise<T> & AbortHandle<void>;

interface OpenTabOptions {
/** A boolean value indicating whether the new tab should be active (selected) or not (default is `false`). */
active?: boolean;
Expand Down Expand Up @@ -1125,7 +1127,7 @@ declare var GM: Readonly<{
xmlHttpRequest<TContext = any>(
// onload and the like still work
details: Tampermonkey.Request<TContext>, // eslint-disable-line @definitelytyped/no-unnecessary-generics
): Promise<Tampermonkey.Response<TContext>>;
): Tampermonkey.PromiseWithAbort<Tampermonkey.Response<TContext>>;

// GM_download has two signatures, GM.download has one
/**
Expand Down
4 changes: 4 additions & 0 deletions types/tampermonkey/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
{
"name": "double-beep",
"githubUsername": "double-beep"
},
{
"name": "ziuchen",
"githubUsername": "ziuchen"
}
]
}
9 changes: 9 additions & 0 deletions types/tampermonkey/tampermonkey-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down