@types/node 22.15.33 → 22.18.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v22.18/README.md +15 -0
- {node v22.15 → node v22.18}/assert.d.ts +19 -0
- {node v22.15 → node v22.18}/buffer.d.ts +6 -2
- {node v22.15 → node v22.18}/child_process.d.ts +26 -122
- {node v22.15 → node v22.18}/crypto.d.ts +17 -1
- {node v22.15 → node v22.18}/dns/promises.d.ts +11 -10
- {node v22.15 → node v22.18}/dns.d.ts +18 -19
- {node v22.15 → node v22.18}/events.d.ts +79 -34
- {node v22.15 → node v22.18}/fs/promises.d.ts +41 -37
- {node v22.15 → node v22.18}/fs.d.ts +55 -44
- node v22.18/globals.d.ts +170 -0
- {node v22.15 → node v22.18}/http.d.ts +67 -5
- {node v22.15 → node v22.18}/http2.d.ts +12 -1
- {node v22.15 → node v22.18}/https.d.ts +5 -0
- {node v22.15 → node v22.18}/index.d.ts +7 -3
- node v22.15/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
- {node v22.15 → node v22.18}/module.d.ts +70 -13
- {node v22.15 → node v22.18}/package.json +3 -83
- {node v22.15 → node v22.18}/process.d.ts +3 -4
- {node v22.15 → node v22.18}/readline/promises.d.ts +0 -1
- {node v22.15 → node v22.18}/repl.d.ts +3 -5
- {node v22.15 → node v22.18}/sqlite.d.ts +207 -0
- {node v22.15 → node v22.18}/stream/web.d.ts +8 -0
- {node v22.15 → node v22.18}/stream.d.ts +0 -11
- node v22.18/test.d.ts +2162 -0
- {node v22.15 → node v22.18}/ts5.6/index.d.ts +7 -3
- {node v22.15 → node v22.18}/url.d.ts +12 -3
- {node v22.15 → node v22.18}/util.d.ts +19 -4
- {node v22.15 → node v22.18}/v8.d.ts +27 -30
- node v22.18/web-globals/abortcontroller.d.ts +34 -0
- node v22.18/web-globals/domexception.d.ts +68 -0
- node v22.15/dom-events.d.ts → node v22.18/web-globals/events.d.ts +49 -51
- node v22.18/web-globals/fetch.d.ts +46 -0
- node v22.18/web-globals/navigator.d.ts +22 -0
- node v22.18/web-globals/storage.d.ts +24 -0
- {node v22.15 → node v22.18}/worker_threads.d.ts +86 -67
- {node v22.15 → node v22.18}/zlib.d.ts +8 -2
- node v22.15/README.md +0 -15
- node v22.15/globals.d.ts +0 -364
- node v22.15/test.d.ts +0 -2278
- {node v22.15 → node v22.18}/LICENSE +0 -0
- {node v22.15 → node v22.18}/assert/strict.d.ts +0 -0
- {node v22.15 → node v22.18}/async_hooks.d.ts +1 -1
- {node v22.15 → node v22.18}/buffer.buffer.d.ts +0 -0
- {node v22.15 → node v22.18}/cluster.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/disposable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/index.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/indexable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/iterators.d.ts +0 -0
- {node v22.15 → node v22.18}/console.d.ts +0 -0
- {node v22.15 → node v22.18}/constants.d.ts +0 -0
- {node v22.15 → node v22.18}/dgram.d.ts +0 -0
- {node v22.15 → node v22.18}/diagnostics_channel.d.ts +0 -0
- {node v22.15 → node v22.18}/domain.d.ts +0 -0
- {node v22.15 → node v22.18}/globals.typedarray.d.ts +0 -0
- {node v22.15 → node v22.18}/net.d.ts +0 -0
- {node v22.15 → node v22.18}/os.d.ts +0 -0
- {node v22.15 → node v22.18}/path.d.ts +0 -0
- {node v22.15 → node v22.18}/perf_hooks.d.ts +0 -0
- {node v22.15 → node v22.18}/punycode.d.ts +0 -0
- {node v22.15 → node v22.18}/querystring.d.ts +0 -0
- {node v22.15 → node v22.18}/readline.d.ts +0 -0
- {node v22.15 → node v22.18}/sea.d.ts +0 -0
- {node v22.15 → node v22.18}/stream/consumers.d.ts +0 -0
- {node v22.15 → node v22.18}/stream/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/string_decoder.d.ts +0 -0
- {node v22.15 → node v22.18}/timers/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers.d.ts +0 -0
- {node v22.15 → node v22.18}/tls.d.ts +0 -0
- {node v22.15 → node v22.18}/trace_events.d.ts +0 -0
- {node v22.15 → node v22.18}/ts5.6/buffer.buffer.d.ts +0 -0
- {node v22.15 → node v22.18}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v22.15 → node v22.18}/tty.d.ts +0 -0
- {node v22.15 → node v22.18}/vm.d.ts +0 -0
- {node v22.15 → node v22.18}/wasi.d.ts +0 -0
|
@@ -15,28 +15,31 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ```js
|
|
17
17
|
* import {
|
|
18
|
-
* Worker,
|
|
18
|
+
* Worker,
|
|
19
|
+
* isMainThread,
|
|
20
|
+
* parentPort,
|
|
21
|
+
* workerData,
|
|
19
22
|
* } from 'node:worker_threads';
|
|
20
|
-
* import { parse } from 'some-js-parsing-library';
|
|
21
23
|
*
|
|
22
|
-
* if (isMainThread) {
|
|
23
|
-
*
|
|
24
|
-
* return new Promise((resolve, reject) => {
|
|
25
|
-
* const worker = new Worker(__filename, {
|
|
26
|
-
* workerData: script,
|
|
27
|
-
* });
|
|
28
|
-
* worker.on('message', resolve);
|
|
29
|
-
* worker.on('error', reject);
|
|
30
|
-
* worker.on('exit', (code) => {
|
|
31
|
-
* if (code !== 0)
|
|
32
|
-
* reject(new Error(`Worker stopped with exit code ${code}`));
|
|
33
|
-
* });
|
|
34
|
-
* });
|
|
35
|
-
* };
|
|
36
|
-
* } else {
|
|
24
|
+
* if (!isMainThread) {
|
|
25
|
+
* const { parse } = await import('some-js-parsing-library');
|
|
37
26
|
* const script = workerData;
|
|
38
27
|
* parentPort.postMessage(parse(script));
|
|
39
28
|
* }
|
|
29
|
+
*
|
|
30
|
+
* export default function parseJSAsync(script) {
|
|
31
|
+
* return new Promise((resolve, reject) => {
|
|
32
|
+
* const worker = new Worker(new URL(import.meta.url), {
|
|
33
|
+
* workerData: script,
|
|
34
|
+
* });
|
|
35
|
+
* worker.on('message', resolve);
|
|
36
|
+
* worker.on('error', reject);
|
|
37
|
+
* worker.on('exit', (code) => {
|
|
38
|
+
* if (code !== 0)
|
|
39
|
+
* reject(new Error(`Worker stopped with exit code ${code}`));
|
|
40
|
+
* });
|
|
41
|
+
* });
|
|
42
|
+
* };
|
|
40
43
|
* ```
|
|
41
44
|
*
|
|
42
45
|
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
|
@@ -53,12 +56,14 @@
|
|
|
53
56
|
*/
|
|
54
57
|
declare module "worker_threads" {
|
|
55
58
|
import { Context } from "node:vm";
|
|
56
|
-
import { EventEmitter } from "node:events";
|
|
59
|
+
import { EventEmitter, NodeEventTarget } from "node:events";
|
|
57
60
|
import { EventLoopUtilityFunction } from "node:perf_hooks";
|
|
58
61
|
import { FileHandle } from "node:fs/promises";
|
|
59
62
|
import { Readable, Writable } from "node:stream";
|
|
60
63
|
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
|
61
64
|
import { URL } from "node:url";
|
|
65
|
+
import { HeapInfo } from "node:v8";
|
|
66
|
+
import { MessageEvent } from "undici-types";
|
|
62
67
|
const isInternalThread: boolean;
|
|
63
68
|
const isMainThread: boolean;
|
|
64
69
|
const parentPort: null | MessagePort;
|
|
@@ -106,7 +111,7 @@ declare module "worker_threads" {
|
|
|
106
111
|
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
|
|
107
112
|
* @since v10.5.0
|
|
108
113
|
*/
|
|
109
|
-
class MessagePort
|
|
114
|
+
class MessagePort implements EventTarget {
|
|
110
115
|
/**
|
|
111
116
|
* Disables further sending of messages on either side of the connection.
|
|
112
117
|
* This method can be called when no further communication will happen over this `MessagePort`.
|
|
@@ -183,6 +188,11 @@ declare module "worker_threads" {
|
|
|
183
188
|
* @since v10.5.0
|
|
184
189
|
*/
|
|
185
190
|
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
|
191
|
+
/**
|
|
192
|
+
* If true, the `MessagePort` object will keep the Node.js event loop active.
|
|
193
|
+
* @since v18.1.0, v16.17.0
|
|
194
|
+
*/
|
|
195
|
+
hasRef(): boolean;
|
|
186
196
|
/**
|
|
187
197
|
* Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
|
|
188
198
|
* behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
|
|
@@ -214,42 +224,32 @@ declare module "worker_threads" {
|
|
|
214
224
|
* @since v10.5.0
|
|
215
225
|
*/
|
|
216
226
|
start(): void;
|
|
217
|
-
addListener(event: "close", listener: () => void): this;
|
|
227
|
+
addListener(event: "close", listener: (ev: Event) => void): this;
|
|
218
228
|
addListener(event: "message", listener: (value: any) => void): this;
|
|
219
229
|
addListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
220
|
-
addListener(event: string
|
|
221
|
-
emit(event: "close"): boolean;
|
|
230
|
+
addListener(event: string, listener: (arg: any) => void): this;
|
|
231
|
+
emit(event: "close", ev: Event): boolean;
|
|
222
232
|
emit(event: "message", value: any): boolean;
|
|
223
233
|
emit(event: "messageerror", error: Error): boolean;
|
|
224
|
-
emit(event: string
|
|
225
|
-
|
|
234
|
+
emit(event: string, arg: any): boolean;
|
|
235
|
+
off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
|
|
236
|
+
off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
|
|
237
|
+
off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
|
|
238
|
+
off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
|
239
|
+
on(event: "close", listener: (ev: Event) => void): this;
|
|
226
240
|
on(event: "message", listener: (value: any) => void): this;
|
|
227
241
|
on(event: "messageerror", listener: (error: Error) => void): this;
|
|
228
|
-
on(event: string
|
|
229
|
-
once(event: "close", listener: () => void): this;
|
|
242
|
+
on(event: string, listener: (arg: any) => void): this;
|
|
243
|
+
once(event: "close", listener: (ev: Event) => void): this;
|
|
230
244
|
once(event: "message", listener: (value: any) => void): this;
|
|
231
245
|
once(event: "messageerror", listener: (error: Error) => void): this;
|
|
232
|
-
once(event: string
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
prependOnceListener(event: "close", listener: () => void): this;
|
|
238
|
-
prependOnceListener(event: "message", listener: (value: any) => void): this;
|
|
239
|
-
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
240
|
-
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
241
|
-
removeListener(event: "close", listener: () => void): this;
|
|
242
|
-
removeListener(event: "message", listener: (value: any) => void): this;
|
|
243
|
-
removeListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
244
|
-
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
245
|
-
off(event: "close", listener: () => void): this;
|
|
246
|
-
off(event: "message", listener: (value: any) => void): this;
|
|
247
|
-
off(event: "messageerror", listener: (error: Error) => void): this;
|
|
248
|
-
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
249
|
-
addEventListener: EventTarget["addEventListener"];
|
|
250
|
-
dispatchEvent: EventTarget["dispatchEvent"];
|
|
251
|
-
removeEventListener: EventTarget["removeEventListener"];
|
|
246
|
+
once(event: string, listener: (arg: any) => void): this;
|
|
247
|
+
removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
|
|
248
|
+
removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
|
|
249
|
+
removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
|
|
250
|
+
removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
|
252
251
|
}
|
|
252
|
+
interface MessagePort extends NodeEventTarget {}
|
|
253
253
|
interface WorkerOptions {
|
|
254
254
|
/**
|
|
255
255
|
* List of arguments which would be stringified and appended to
|
|
@@ -418,24 +418,6 @@ declare module "worker_threads" {
|
|
|
418
418
|
* @since v10.5.0
|
|
419
419
|
*/
|
|
420
420
|
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
|
421
|
-
/**
|
|
422
|
-
* Sends a value to another worker, identified by its thread ID.
|
|
423
|
-
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
|
424
|
-
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
|
425
|
-
* @param value The value to send.
|
|
426
|
-
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
|
427
|
-
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
|
428
|
-
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
|
429
|
-
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
|
430
|
-
* @since v22.5.0
|
|
431
|
-
*/
|
|
432
|
-
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
|
433
|
-
postMessageToThread(
|
|
434
|
-
threadId: number,
|
|
435
|
-
value: any,
|
|
436
|
-
transferList: readonly Transferable[],
|
|
437
|
-
timeout?: number,
|
|
438
|
-
): Promise<void>;
|
|
439
421
|
/**
|
|
440
422
|
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
|
|
441
423
|
* behavior). If the worker is `ref()`ed, calling `ref()` again has
|
|
@@ -465,6 +447,25 @@ declare module "worker_threads" {
|
|
|
465
447
|
* @return A promise for a Readable Stream containing a V8 heap snapshot
|
|
466
448
|
*/
|
|
467
449
|
getHeapSnapshot(): Promise<Readable>;
|
|
450
|
+
/**
|
|
451
|
+
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
|
|
452
|
+
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
|
453
|
+
* This methods allows the statistics to be observed from outside the actual thread.
|
|
454
|
+
* @since v22.16.0
|
|
455
|
+
*/
|
|
456
|
+
getHeapStatistics(): Promise<HeapInfo>;
|
|
457
|
+
/**
|
|
458
|
+
* Calls `worker.terminate()` when the dispose scope is exited.
|
|
459
|
+
*
|
|
460
|
+
* ```js
|
|
461
|
+
* async function example() {
|
|
462
|
+
* await using worker = new Worker('for (;;) {}', { eval: true });
|
|
463
|
+
* // Worker is automatically terminate when the scope is exited.
|
|
464
|
+
* }
|
|
465
|
+
* ```
|
|
466
|
+
* @since v22.18.0
|
|
467
|
+
*/
|
|
468
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
468
469
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
469
470
|
addListener(event: "exit", listener: (exitCode: number) => void): this;
|
|
470
471
|
addListener(event: "message", listener: (value: any) => void): this;
|
|
@@ -545,18 +546,18 @@ declare module "worker_threads" {
|
|
|
545
546
|
* ```
|
|
546
547
|
* @since v15.4.0
|
|
547
548
|
*/
|
|
548
|
-
class BroadcastChannel {
|
|
549
|
+
class BroadcastChannel extends EventTarget {
|
|
549
550
|
readonly name: string;
|
|
550
551
|
/**
|
|
551
552
|
* Invoked with a single \`MessageEvent\` argument when a message is received.
|
|
552
553
|
* @since v15.4.0
|
|
553
554
|
*/
|
|
554
|
-
onmessage: (message:
|
|
555
|
+
onmessage: (message: MessageEvent) => void;
|
|
555
556
|
/**
|
|
556
557
|
* Invoked with a received message cannot be deserialized.
|
|
557
558
|
* @since v15.4.0
|
|
558
559
|
*/
|
|
559
|
-
onmessageerror: (message:
|
|
560
|
+
onmessageerror: (message: MessageEvent) => void;
|
|
560
561
|
constructor(name: string);
|
|
561
562
|
/**
|
|
562
563
|
* Closes the `BroadcastChannel` connection.
|
|
@@ -710,6 +711,24 @@ declare module "worker_threads" {
|
|
|
710
711
|
* for the `key` will be deleted.
|
|
711
712
|
*/
|
|
712
713
|
function setEnvironmentData(key: Serializable, value?: Serializable): void;
|
|
714
|
+
/**
|
|
715
|
+
* Sends a value to another worker, identified by its thread ID.
|
|
716
|
+
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
|
717
|
+
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
|
718
|
+
* @param value The value to send.
|
|
719
|
+
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
|
720
|
+
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
|
721
|
+
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
|
722
|
+
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
|
723
|
+
* @since v22.5.0
|
|
724
|
+
*/
|
|
725
|
+
function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
|
726
|
+
function postMessageToThread(
|
|
727
|
+
threadId: number,
|
|
728
|
+
value: any,
|
|
729
|
+
transferList: readonly Transferable[],
|
|
730
|
+
timeout?: number,
|
|
731
|
+
): Promise<void>;
|
|
713
732
|
|
|
714
733
|
import {
|
|
715
734
|
BroadcastChannel as _BroadcastChannel,
|
|
@@ -147,6 +147,10 @@ declare module "zlib" {
|
|
|
147
147
|
* @default buffer.kMaxLength
|
|
148
148
|
*/
|
|
149
149
|
maxOutputLength?: number | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* If `true`, returns an object with `buffer` and `engine`.
|
|
152
|
+
*/
|
|
153
|
+
info?: boolean | undefined;
|
|
150
154
|
}
|
|
151
155
|
interface ZstdOptions {
|
|
152
156
|
/**
|
|
@@ -172,6 +176,10 @@ declare module "zlib" {
|
|
|
172
176
|
* @default buffer.kMaxLength
|
|
173
177
|
*/
|
|
174
178
|
maxOutputLength?: number | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* If `true`, returns an object with `buffer` and `engine`.
|
|
181
|
+
*/
|
|
182
|
+
info?: boolean | undefined;
|
|
175
183
|
}
|
|
176
184
|
interface Zlib {
|
|
177
185
|
/** @deprecated Use bytesWritten instead. */
|
|
@@ -612,8 +620,6 @@ declare module "zlib" {
|
|
|
612
620
|
const Z_FINISH: number;
|
|
613
621
|
/** @deprecated Use `constants.Z_BLOCK` */
|
|
614
622
|
const Z_BLOCK: number;
|
|
615
|
-
/** @deprecated Use `constants.Z_TREES` */
|
|
616
|
-
const Z_TREES: number;
|
|
617
623
|
// Return codes for the compression/decompression functions.
|
|
618
624
|
// Negative values are errors, positive values are used for special but normal events.
|
|
619
625
|
/** @deprecated Use `constants.Z_OK` */
|
node v22.15/README.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Installation
|
|
2
|
-
> `npm install --save @types/node`
|
|
3
|
-
|
|
4
|
-
# Summary
|
|
5
|
-
This package contains type definitions for node (https://nodejs.org/).
|
|
6
|
-
|
|
7
|
-
# Details
|
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22.
|
|
9
|
-
|
|
10
|
-
### Additional Details
|
|
11
|
-
* Last updated: Tue, 24 Jun 2025 16:39:29 GMT
|
|
12
|
-
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
|
-
|
|
14
|
-
# Credits
|
|
15
|
-
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), and [René](https://github.com/Renegade334).
|
node v22.15/globals.d.ts
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
export {}; // Make this a module
|
|
2
|
-
|
|
3
|
-
// #region Fetch and friends
|
|
4
|
-
// Conditional type aliases, used at the end of this file.
|
|
5
|
-
// Will either be empty if lib.dom (or lib.webworker) is included, or the undici version otherwise.
|
|
6
|
-
type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
|
|
7
|
-
type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
|
|
8
|
-
type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
|
|
9
|
-
type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
|
|
10
|
-
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
|
|
11
|
-
type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
|
|
12
|
-
: import("undici-types").RequestInit;
|
|
13
|
-
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
|
|
14
|
-
: import("undici-types").ResponseInit;
|
|
15
|
-
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").WebSocket;
|
|
16
|
-
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
|
|
17
|
-
// #endregion Fetch and friends
|
|
18
|
-
|
|
19
|
-
// Conditional type definitions for webstorage interface, which conflicts with lib.dom otherwise.
|
|
20
|
-
type _Storage = typeof globalThis extends { onabort: any } ? {} : {
|
|
21
|
-
readonly length: number;
|
|
22
|
-
clear(): void;
|
|
23
|
-
getItem(key: string): string | null;
|
|
24
|
-
key(index: number): string | null;
|
|
25
|
-
removeItem(key: string): void;
|
|
26
|
-
setItem(key: string, value: string): void;
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// #region DOMException
|
|
31
|
-
type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
|
|
32
|
-
interface NodeDOMException extends Error {
|
|
33
|
-
readonly code: number;
|
|
34
|
-
readonly message: string;
|
|
35
|
-
readonly name: string;
|
|
36
|
-
readonly INDEX_SIZE_ERR: 1;
|
|
37
|
-
readonly DOMSTRING_SIZE_ERR: 2;
|
|
38
|
-
readonly HIERARCHY_REQUEST_ERR: 3;
|
|
39
|
-
readonly WRONG_DOCUMENT_ERR: 4;
|
|
40
|
-
readonly INVALID_CHARACTER_ERR: 5;
|
|
41
|
-
readonly NO_DATA_ALLOWED_ERR: 6;
|
|
42
|
-
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
|
43
|
-
readonly NOT_FOUND_ERR: 8;
|
|
44
|
-
readonly NOT_SUPPORTED_ERR: 9;
|
|
45
|
-
readonly INUSE_ATTRIBUTE_ERR: 10;
|
|
46
|
-
readonly INVALID_STATE_ERR: 11;
|
|
47
|
-
readonly SYNTAX_ERR: 12;
|
|
48
|
-
readonly INVALID_MODIFICATION_ERR: 13;
|
|
49
|
-
readonly NAMESPACE_ERR: 14;
|
|
50
|
-
readonly INVALID_ACCESS_ERR: 15;
|
|
51
|
-
readonly VALIDATION_ERR: 16;
|
|
52
|
-
readonly TYPE_MISMATCH_ERR: 17;
|
|
53
|
-
readonly SECURITY_ERR: 18;
|
|
54
|
-
readonly NETWORK_ERR: 19;
|
|
55
|
-
readonly ABORT_ERR: 20;
|
|
56
|
-
readonly URL_MISMATCH_ERR: 21;
|
|
57
|
-
readonly QUOTA_EXCEEDED_ERR: 22;
|
|
58
|
-
readonly TIMEOUT_ERR: 23;
|
|
59
|
-
readonly INVALID_NODE_TYPE_ERR: 24;
|
|
60
|
-
readonly DATA_CLONE_ERR: 25;
|
|
61
|
-
}
|
|
62
|
-
interface NodeDOMExceptionConstructor {
|
|
63
|
-
prototype: DOMException;
|
|
64
|
-
new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
|
|
65
|
-
readonly INDEX_SIZE_ERR: 1;
|
|
66
|
-
readonly DOMSTRING_SIZE_ERR: 2;
|
|
67
|
-
readonly HIERARCHY_REQUEST_ERR: 3;
|
|
68
|
-
readonly WRONG_DOCUMENT_ERR: 4;
|
|
69
|
-
readonly INVALID_CHARACTER_ERR: 5;
|
|
70
|
-
readonly NO_DATA_ALLOWED_ERR: 6;
|
|
71
|
-
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
|
72
|
-
readonly NOT_FOUND_ERR: 8;
|
|
73
|
-
readonly NOT_SUPPORTED_ERR: 9;
|
|
74
|
-
readonly INUSE_ATTRIBUTE_ERR: 10;
|
|
75
|
-
readonly INVALID_STATE_ERR: 11;
|
|
76
|
-
readonly SYNTAX_ERR: 12;
|
|
77
|
-
readonly INVALID_MODIFICATION_ERR: 13;
|
|
78
|
-
readonly NAMESPACE_ERR: 14;
|
|
79
|
-
readonly INVALID_ACCESS_ERR: 15;
|
|
80
|
-
readonly VALIDATION_ERR: 16;
|
|
81
|
-
readonly TYPE_MISMATCH_ERR: 17;
|
|
82
|
-
readonly SECURITY_ERR: 18;
|
|
83
|
-
readonly NETWORK_ERR: 19;
|
|
84
|
-
readonly ABORT_ERR: 20;
|
|
85
|
-
readonly URL_MISMATCH_ERR: 21;
|
|
86
|
-
readonly QUOTA_EXCEEDED_ERR: 22;
|
|
87
|
-
readonly TIMEOUT_ERR: 23;
|
|
88
|
-
readonly INVALID_NODE_TYPE_ERR: 24;
|
|
89
|
-
readonly DATA_CLONE_ERR: 25;
|
|
90
|
-
}
|
|
91
|
-
// #endregion DOMException
|
|
92
|
-
|
|
93
|
-
declare global {
|
|
94
|
-
var global: typeof globalThis;
|
|
95
|
-
|
|
96
|
-
var process: NodeJS.Process;
|
|
97
|
-
var console: Console;
|
|
98
|
-
|
|
99
|
-
interface ErrorConstructor {
|
|
100
|
-
/**
|
|
101
|
-
* Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
102
|
-
* a string representing the location in the code at which
|
|
103
|
-
* `Error.captureStackTrace()` was called.
|
|
104
|
-
*
|
|
105
|
-
* ```js
|
|
106
|
-
* const myObject = {};
|
|
107
|
-
* Error.captureStackTrace(myObject);
|
|
108
|
-
* myObject.stack; // Similar to `new Error().stack`
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* The first line of the trace will be prefixed with
|
|
112
|
-
* `${myObject.name}: ${myObject.message}`.
|
|
113
|
-
*
|
|
114
|
-
* The optional `constructorOpt` argument accepts a function. If given, all frames
|
|
115
|
-
* above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
|
116
|
-
* generated stack trace.
|
|
117
|
-
*
|
|
118
|
-
* The `constructorOpt` argument is useful for hiding implementation
|
|
119
|
-
* details of error generation from the user. For instance:
|
|
120
|
-
*
|
|
121
|
-
* ```js
|
|
122
|
-
* function a() {
|
|
123
|
-
* b();
|
|
124
|
-
* }
|
|
125
|
-
*
|
|
126
|
-
* function b() {
|
|
127
|
-
* c();
|
|
128
|
-
* }
|
|
129
|
-
*
|
|
130
|
-
* function c() {
|
|
131
|
-
* // Create an error without stack trace to avoid calculating the stack trace twice.
|
|
132
|
-
* const { stackTraceLimit } = Error;
|
|
133
|
-
* Error.stackTraceLimit = 0;
|
|
134
|
-
* const error = new Error();
|
|
135
|
-
* Error.stackTraceLimit = stackTraceLimit;
|
|
136
|
-
*
|
|
137
|
-
* // Capture the stack trace above function b
|
|
138
|
-
* Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
|
|
139
|
-
* throw error;
|
|
140
|
-
* }
|
|
141
|
-
*
|
|
142
|
-
* a();
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
146
|
-
/**
|
|
147
|
-
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
148
|
-
*/
|
|
149
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
150
|
-
/**
|
|
151
|
-
* The `Error.stackTraceLimit` property specifies the number of stack frames
|
|
152
|
-
* collected by a stack trace (whether generated by `new Error().stack` or
|
|
153
|
-
* `Error.captureStackTrace(obj)`).
|
|
154
|
-
*
|
|
155
|
-
* The default value is `10` but may be set to any valid JavaScript number. Changes
|
|
156
|
-
* will affect any stack trace captured _after_ the value has been changed.
|
|
157
|
-
*
|
|
158
|
-
* If set to a non-number value, or set to a negative number, stack traces will
|
|
159
|
-
* not capture any frames.
|
|
160
|
-
*/
|
|
161
|
-
stackTraceLimit: number;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Enable this API with the `--expose-gc` CLI flag.
|
|
166
|
-
*/
|
|
167
|
-
var gc: NodeJS.GCFunction | undefined;
|
|
168
|
-
|
|
169
|
-
namespace NodeJS {
|
|
170
|
-
interface CallSite {
|
|
171
|
-
getColumnNumber(): number | null;
|
|
172
|
-
getEnclosingColumnNumber(): number | null;
|
|
173
|
-
getEnclosingLineNumber(): number | null;
|
|
174
|
-
getEvalOrigin(): string | undefined;
|
|
175
|
-
getFileName(): string | null;
|
|
176
|
-
getFunction(): Function | undefined;
|
|
177
|
-
getFunctionName(): string | null;
|
|
178
|
-
getLineNumber(): number | null;
|
|
179
|
-
getMethodName(): string | null;
|
|
180
|
-
getPosition(): number;
|
|
181
|
-
getPromiseIndex(): number | null;
|
|
182
|
-
getScriptHash(): string;
|
|
183
|
-
getScriptNameOrSourceURL(): string | null;
|
|
184
|
-
getThis(): unknown;
|
|
185
|
-
getTypeName(): string | null;
|
|
186
|
-
isAsync(): boolean;
|
|
187
|
-
isConstructor(): boolean;
|
|
188
|
-
isEval(): boolean;
|
|
189
|
-
isNative(): boolean;
|
|
190
|
-
isPromiseAll(): boolean;
|
|
191
|
-
isToplevel(): boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
interface ErrnoException extends Error {
|
|
195
|
-
errno?: number | undefined;
|
|
196
|
-
code?: string | undefined;
|
|
197
|
-
path?: string | undefined;
|
|
198
|
-
syscall?: string | undefined;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
interface ReadableStream extends EventEmitter {
|
|
202
|
-
readable: boolean;
|
|
203
|
-
read(size?: number): string | Buffer;
|
|
204
|
-
setEncoding(encoding: BufferEncoding): this;
|
|
205
|
-
pause(): this;
|
|
206
|
-
resume(): this;
|
|
207
|
-
isPaused(): boolean;
|
|
208
|
-
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
|
|
209
|
-
unpipe(destination?: WritableStream): this;
|
|
210
|
-
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
211
|
-
wrap(oldStream: ReadableStream): this;
|
|
212
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
interface WritableStream extends EventEmitter {
|
|
216
|
-
writable: boolean;
|
|
217
|
-
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
218
|
-
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
219
|
-
end(cb?: () => void): this;
|
|
220
|
-
end(data: string | Uint8Array, cb?: () => void): this;
|
|
221
|
-
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
interface ReadWriteStream extends ReadableStream, WritableStream {}
|
|
225
|
-
|
|
226
|
-
interface RefCounted {
|
|
227
|
-
ref(): this;
|
|
228
|
-
unref(): this;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
interface Dict<T> {
|
|
232
|
-
[key: string]: T | undefined;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
interface ReadOnlyDict<T> {
|
|
236
|
-
readonly [key: string]: T | undefined;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
interface GCFunction {
|
|
240
|
-
(minor?: boolean): void;
|
|
241
|
-
(options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
|
|
242
|
-
(options: NodeJS.GCOptions): void;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
interface GCOptions {
|
|
246
|
-
execution?: "sync" | "async" | undefined;
|
|
247
|
-
flavor?: "regular" | "last-resort" | undefined;
|
|
248
|
-
type?: "major-snapshot" | "major" | "minor" | undefined;
|
|
249
|
-
filename?: string | undefined;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/** An iterable iterator returned by the Node.js API. */
|
|
253
|
-
// Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used IterableIterator.
|
|
254
|
-
interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
|
|
255
|
-
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/** An async iterable iterator returned by the Node.js API. */
|
|
259
|
-
// Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used AsyncIterableIterator.
|
|
260
|
-
interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
|
|
261
|
-
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Global DOM types
|
|
266
|
-
|
|
267
|
-
interface DOMException extends _DOMException {}
|
|
268
|
-
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
|
269
|
-
: NodeDOMExceptionConstructor;
|
|
270
|
-
|
|
271
|
-
// #region AbortController
|
|
272
|
-
interface AbortController {
|
|
273
|
-
readonly signal: AbortSignal;
|
|
274
|
-
abort(reason?: any): void;
|
|
275
|
-
}
|
|
276
|
-
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
|
277
|
-
: {
|
|
278
|
-
prototype: AbortController;
|
|
279
|
-
new(): AbortController;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
interface AbortSignal extends EventTarget {
|
|
283
|
-
readonly aborted: boolean;
|
|
284
|
-
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
285
|
-
readonly reason: any;
|
|
286
|
-
throwIfAborted(): void;
|
|
287
|
-
}
|
|
288
|
-
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
|
289
|
-
: {
|
|
290
|
-
prototype: AbortSignal;
|
|
291
|
-
new(): AbortSignal;
|
|
292
|
-
abort(reason?: any): AbortSignal;
|
|
293
|
-
any(signals: AbortSignal[]): AbortSignal;
|
|
294
|
-
timeout(milliseconds: number): AbortSignal;
|
|
295
|
-
};
|
|
296
|
-
// #endregion AbortController
|
|
297
|
-
|
|
298
|
-
// #region Storage
|
|
299
|
-
interface Storage extends _Storage {}
|
|
300
|
-
// Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker
|
|
301
|
-
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T
|
|
302
|
-
: {
|
|
303
|
-
prototype: Storage;
|
|
304
|
-
new(): Storage;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
var localStorage: Storage;
|
|
308
|
-
var sessionStorage: Storage;
|
|
309
|
-
// #endregion Storage
|
|
310
|
-
|
|
311
|
-
// #region fetch
|
|
312
|
-
interface RequestInit extends _RequestInit {}
|
|
313
|
-
|
|
314
|
-
function fetch(
|
|
315
|
-
input: string | URL | globalThis.Request,
|
|
316
|
-
init?: RequestInit,
|
|
317
|
-
): Promise<Response>;
|
|
318
|
-
|
|
319
|
-
interface Request extends _Request {}
|
|
320
|
-
var Request: typeof globalThis extends {
|
|
321
|
-
onmessage: any;
|
|
322
|
-
Request: infer T;
|
|
323
|
-
} ? T
|
|
324
|
-
: typeof import("undici-types").Request;
|
|
325
|
-
|
|
326
|
-
interface ResponseInit extends _ResponseInit {}
|
|
327
|
-
|
|
328
|
-
interface Response extends _Response {}
|
|
329
|
-
var Response: typeof globalThis extends {
|
|
330
|
-
onmessage: any;
|
|
331
|
-
Response: infer T;
|
|
332
|
-
} ? T
|
|
333
|
-
: typeof import("undici-types").Response;
|
|
334
|
-
|
|
335
|
-
interface FormData extends _FormData {}
|
|
336
|
-
var FormData: typeof globalThis extends {
|
|
337
|
-
onmessage: any;
|
|
338
|
-
FormData: infer T;
|
|
339
|
-
} ? T
|
|
340
|
-
: typeof import("undici-types").FormData;
|
|
341
|
-
|
|
342
|
-
interface Headers extends _Headers {}
|
|
343
|
-
var Headers: typeof globalThis extends {
|
|
344
|
-
onmessage: any;
|
|
345
|
-
Headers: infer T;
|
|
346
|
-
} ? T
|
|
347
|
-
: typeof import("undici-types").Headers;
|
|
348
|
-
|
|
349
|
-
interface MessageEvent extends _MessageEvent {}
|
|
350
|
-
var MessageEvent: typeof globalThis extends {
|
|
351
|
-
onmessage: any;
|
|
352
|
-
MessageEvent: infer T;
|
|
353
|
-
} ? T
|
|
354
|
-
: typeof import("undici-types").MessageEvent;
|
|
355
|
-
|
|
356
|
-
interface WebSocket extends _WebSocket {}
|
|
357
|
-
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T
|
|
358
|
-
: typeof import("undici-types").WebSocket;
|
|
359
|
-
|
|
360
|
-
interface EventSource extends _EventSource {}
|
|
361
|
-
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
|
|
362
|
-
: typeof import("undici-types").EventSource;
|
|
363
|
-
// #endregion fetch
|
|
364
|
-
}
|