@types/node 20.19.12 → 20.19.14

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 v20.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 03 Sep 2025 10:02:19 GMT
11
+ * Last updated: Sat, 13 Sep 2025 00:03:47 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -1,335 +1,170 @@
1
- export {}; // Make this a module
1
+ declare var global: typeof globalThis;
2
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 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 _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
16
- // #endregion Fetch and friends
17
-
18
- // #region DOMException
19
- type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
20
- interface NodeDOMException extends Error {
21
- readonly code: number;
22
- readonly message: string;
23
- readonly name: string;
24
- readonly INDEX_SIZE_ERR: 1;
25
- readonly DOMSTRING_SIZE_ERR: 2;
26
- readonly HIERARCHY_REQUEST_ERR: 3;
27
- readonly WRONG_DOCUMENT_ERR: 4;
28
- readonly INVALID_CHARACTER_ERR: 5;
29
- readonly NO_DATA_ALLOWED_ERR: 6;
30
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
31
- readonly NOT_FOUND_ERR: 8;
32
- readonly NOT_SUPPORTED_ERR: 9;
33
- readonly INUSE_ATTRIBUTE_ERR: 10;
34
- readonly INVALID_STATE_ERR: 11;
35
- readonly SYNTAX_ERR: 12;
36
- readonly INVALID_MODIFICATION_ERR: 13;
37
- readonly NAMESPACE_ERR: 14;
38
- readonly INVALID_ACCESS_ERR: 15;
39
- readonly VALIDATION_ERR: 16;
40
- readonly TYPE_MISMATCH_ERR: 17;
41
- readonly SECURITY_ERR: 18;
42
- readonly NETWORK_ERR: 19;
43
- readonly ABORT_ERR: 20;
44
- readonly URL_MISMATCH_ERR: 21;
45
- readonly QUOTA_EXCEEDED_ERR: 22;
46
- readonly TIMEOUT_ERR: 23;
47
- readonly INVALID_NODE_TYPE_ERR: 24;
48
- readonly DATA_CLONE_ERR: 25;
49
- }
50
- interface NodeDOMExceptionConstructor {
51
- prototype: DOMException;
52
- new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
53
- readonly INDEX_SIZE_ERR: 1;
54
- readonly DOMSTRING_SIZE_ERR: 2;
55
- readonly HIERARCHY_REQUEST_ERR: 3;
56
- readonly WRONG_DOCUMENT_ERR: 4;
57
- readonly INVALID_CHARACTER_ERR: 5;
58
- readonly NO_DATA_ALLOWED_ERR: 6;
59
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
60
- readonly NOT_FOUND_ERR: 8;
61
- readonly NOT_SUPPORTED_ERR: 9;
62
- readonly INUSE_ATTRIBUTE_ERR: 10;
63
- readonly INVALID_STATE_ERR: 11;
64
- readonly SYNTAX_ERR: 12;
65
- readonly INVALID_MODIFICATION_ERR: 13;
66
- readonly NAMESPACE_ERR: 14;
67
- readonly INVALID_ACCESS_ERR: 15;
68
- readonly VALIDATION_ERR: 16;
69
- readonly TYPE_MISMATCH_ERR: 17;
70
- readonly SECURITY_ERR: 18;
71
- readonly NETWORK_ERR: 19;
72
- readonly ABORT_ERR: 20;
73
- readonly URL_MISMATCH_ERR: 21;
74
- readonly QUOTA_EXCEEDED_ERR: 22;
75
- readonly TIMEOUT_ERR: 23;
76
- readonly INVALID_NODE_TYPE_ERR: 24;
77
- readonly DATA_CLONE_ERR: 25;
78
- }
79
- // #endregion DOMException
80
-
81
- declare global {
82
- var global: typeof globalThis;
83
-
84
- var process: NodeJS.Process;
85
- var console: Console;
86
-
87
- interface ErrorConstructor {
88
- /**
89
- * Creates a `.stack` property on `targetObject`, which when accessed returns
90
- * a string representing the location in the code at which
91
- * `Error.captureStackTrace()` was called.
92
- *
93
- * ```js
94
- * const myObject = {};
95
- * Error.captureStackTrace(myObject);
96
- * myObject.stack; // Similar to `new Error().stack`
97
- * ```
98
- *
99
- * The first line of the trace will be prefixed with
100
- * `${myObject.name}: ${myObject.message}`.
101
- *
102
- * The optional `constructorOpt` argument accepts a function. If given, all frames
103
- * above `constructorOpt`, including `constructorOpt`, will be omitted from the
104
- * generated stack trace.
105
- *
106
- * The `constructorOpt` argument is useful for hiding implementation
107
- * details of error generation from the user. For instance:
108
- *
109
- * ```js
110
- * function a() {
111
- * b();
112
- * }
113
- *
114
- * function b() {
115
- * c();
116
- * }
117
- *
118
- * function c() {
119
- * // Create an error without stack trace to avoid calculating the stack trace twice.
120
- * const { stackTraceLimit } = Error;
121
- * Error.stackTraceLimit = 0;
122
- * const error = new Error();
123
- * Error.stackTraceLimit = stackTraceLimit;
124
- *
125
- * // Capture the stack trace above function b
126
- * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
127
- * throw error;
128
- * }
129
- *
130
- * a();
131
- * ```
132
- */
133
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
134
- /**
135
- * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
136
- */
137
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
138
- /**
139
- * The `Error.stackTraceLimit` property specifies the number of stack frames
140
- * collected by a stack trace (whether generated by `new Error().stack` or
141
- * `Error.captureStackTrace(obj)`).
142
- *
143
- * The default value is `10` but may be set to any valid JavaScript number. Changes
144
- * will affect any stack trace captured _after_ the value has been changed.
145
- *
146
- * If set to a non-number value, or set to a negative number, stack traces will
147
- * not capture any frames.
148
- */
149
- stackTraceLimit: number;
150
- }
3
+ declare var process: NodeJS.Process;
4
+ declare var console: Console;
151
5
 
6
+ interface ErrorConstructor {
152
7
  /**
153
- * Enable this API with the `--expose-gc` CLI flag.
8
+ * Creates a `.stack` property on `targetObject`, which when accessed returns
9
+ * a string representing the location in the code at which
10
+ * `Error.captureStackTrace()` was called.
11
+ *
12
+ * ```js
13
+ * const myObject = {};
14
+ * Error.captureStackTrace(myObject);
15
+ * myObject.stack; // Similar to `new Error().stack`
16
+ * ```
17
+ *
18
+ * The first line of the trace will be prefixed with
19
+ * `${myObject.name}: ${myObject.message}`.
20
+ *
21
+ * The optional `constructorOpt` argument accepts a function. If given, all frames
22
+ * above `constructorOpt`, including `constructorOpt`, will be omitted from the
23
+ * generated stack trace.
24
+ *
25
+ * The `constructorOpt` argument is useful for hiding implementation
26
+ * details of error generation from the user. For instance:
27
+ *
28
+ * ```js
29
+ * function a() {
30
+ * b();
31
+ * }
32
+ *
33
+ * function b() {
34
+ * c();
35
+ * }
36
+ *
37
+ * function c() {
38
+ * // Create an error without stack trace to avoid calculating the stack trace twice.
39
+ * const { stackTraceLimit } = Error;
40
+ * Error.stackTraceLimit = 0;
41
+ * const error = new Error();
42
+ * Error.stackTraceLimit = stackTraceLimit;
43
+ *
44
+ * // Capture the stack trace above function b
45
+ * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
46
+ * throw error;
47
+ * }
48
+ *
49
+ * a();
50
+ * ```
154
51
  */
155
- var gc: NodeJS.GCFunction | undefined;
156
-
157
- namespace NodeJS {
158
- interface CallSite {
159
- getColumnNumber(): number | null;
160
- getEnclosingColumnNumber(): number | null;
161
- getEnclosingLineNumber(): number | null;
162
- getEvalOrigin(): string | undefined;
163
- getFileName(): string | null;
164
- getFunction(): Function | undefined;
165
- getFunctionName(): string | null;
166
- getLineNumber(): number | null;
167
- getMethodName(): string | null;
168
- getPosition(): number;
169
- getPromiseIndex(): number | null;
170
- getScriptHash(): string;
171
- getScriptNameOrSourceURL(): string | null;
172
- getThis(): unknown;
173
- getTypeName(): string | null;
174
- isAsync(): boolean;
175
- isConstructor(): boolean;
176
- isEval(): boolean;
177
- isNative(): boolean;
178
- isPromiseAll(): boolean;
179
- isToplevel(): boolean;
180
- }
181
-
182
- interface ErrnoException extends Error {
183
- errno?: number | undefined;
184
- code?: string | undefined;
185
- path?: string | undefined;
186
- syscall?: string | undefined;
187
- }
188
-
189
- interface ReadableStream extends EventEmitter {
190
- readable: boolean;
191
- read(size?: number): string | Buffer;
192
- setEncoding(encoding: BufferEncoding): this;
193
- pause(): this;
194
- resume(): this;
195
- isPaused(): boolean;
196
- pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
197
- unpipe(destination?: WritableStream): this;
198
- unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
199
- wrap(oldStream: ReadableStream): this;
200
- [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
201
- }
202
-
203
- interface WritableStream extends EventEmitter {
204
- writable: boolean;
205
- write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
206
- write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
207
- end(cb?: () => void): this;
208
- end(data: string | Uint8Array, cb?: () => void): this;
209
- end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
210
- }
211
-
212
- interface ReadWriteStream extends ReadableStream, WritableStream {}
213
-
214
- interface RefCounted {
215
- ref(): this;
216
- unref(): this;
217
- }
218
-
219
- interface Dict<T> {
220
- [key: string]: T | undefined;
221
- }
222
-
223
- interface ReadOnlyDict<T> {
224
- readonly [key: string]: T | undefined;
225
- }
226
-
227
- interface GCFunction {
228
- (minor?: boolean): void;
229
- (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
230
- (options: NodeJS.GCOptions): void;
231
- }
232
-
233
- interface GCOptions {
234
- execution?: "sync" | "async" | undefined;
235
- flavor?: "regular" | "last-resort" | undefined;
236
- type?: "major-snapshot" | "major" | "minor" | undefined;
237
- filename?: string | undefined;
238
- }
239
-
240
- /** An iterable iterator returned by the Node.js API. */
241
- // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used IterableIterator.
242
- interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
243
- [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
244
- }
52
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
53
+ /**
54
+ * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
55
+ */
56
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
57
+ /**
58
+ * The `Error.stackTraceLimit` property specifies the number of stack frames
59
+ * collected by a stack trace (whether generated by `new Error().stack` or
60
+ * `Error.captureStackTrace(obj)`).
61
+ *
62
+ * The default value is `10` but may be set to any valid JavaScript number. Changes
63
+ * will affect any stack trace captured _after_ the value has been changed.
64
+ *
65
+ * If set to a non-number value, or set to a negative number, stack traces will
66
+ * not capture any frames.
67
+ */
68
+ stackTraceLimit: number;
69
+ }
245
70
 
246
- /** An async iterable iterator returned by the Node.js API. */
247
- // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used AsyncIterableIterator.
248
- interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
249
- [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
250
- }
71
+ /**
72
+ * Enable this API with the `--expose-gc` CLI flag.
73
+ */
74
+ declare var gc: NodeJS.GCFunction | undefined;
75
+
76
+ declare namespace NodeJS {
77
+ interface CallSite {
78
+ getColumnNumber(): number | null;
79
+ getEnclosingColumnNumber(): number | null;
80
+ getEnclosingLineNumber(): number | null;
81
+ getEvalOrigin(): string | undefined;
82
+ getFileName(): string | null;
83
+ getFunction(): Function | undefined;
84
+ getFunctionName(): string | null;
85
+ getLineNumber(): number | null;
86
+ getMethodName(): string | null;
87
+ getPosition(): number;
88
+ getPromiseIndex(): number | null;
89
+ getScriptHash(): string;
90
+ getScriptNameOrSourceURL(): string | null;
91
+ getThis(): unknown;
92
+ getTypeName(): string | null;
93
+ isAsync(): boolean;
94
+ isConstructor(): boolean;
95
+ isEval(): boolean;
96
+ isNative(): boolean;
97
+ isPromiseAll(): boolean;
98
+ isToplevel(): boolean;
251
99
  }
252
100
 
253
- // Global DOM types
254
-
255
- interface DOMException extends _DOMException {}
256
- var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
257
- : NodeDOMExceptionConstructor;
258
-
259
- // #region AbortController
260
- interface AbortController {
261
- readonly signal: AbortSignal;
262
- abort(reason?: any): void;
101
+ interface ErrnoException extends Error {
102
+ errno?: number | undefined;
103
+ code?: string | undefined;
104
+ path?: string | undefined;
105
+ syscall?: string | undefined;
263
106
  }
264
- var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
265
- : {
266
- prototype: AbortController;
267
- new(): AbortController;
268
- };
269
107
 
270
- interface AbortSignal extends EventTarget {
271
- readonly aborted: boolean;
272
- onabort: ((this: AbortSignal, ev: Event) => any) | null;
273
- readonly reason: any;
274
- throwIfAborted(): void;
108
+ interface ReadableStream extends EventEmitter {
109
+ readable: boolean;
110
+ read(size?: number): string | Buffer;
111
+ setEncoding(encoding: BufferEncoding): this;
112
+ pause(): this;
113
+ resume(): this;
114
+ isPaused(): boolean;
115
+ pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
116
+ unpipe(destination?: WritableStream): this;
117
+ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
118
+ wrap(oldStream: ReadableStream): this;
119
+ [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
275
120
  }
276
- var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
277
- : {
278
- prototype: AbortSignal;
279
- new(): AbortSignal;
280
- abort(reason?: any): AbortSignal;
281
- any(signals: AbortSignal[]): AbortSignal;
282
- timeout(milliseconds: number): AbortSignal;
283
- };
284
- // #endregion AbortController
285
121
 
286
- // #region fetch
287
- interface RequestInit extends _RequestInit {}
122
+ interface WritableStream extends EventEmitter {
123
+ writable: boolean;
124
+ write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
125
+ write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
126
+ end(cb?: () => void): this;
127
+ end(data: string | Uint8Array, cb?: () => void): this;
128
+ end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
129
+ }
288
130
 
289
- function fetch(
290
- input: string | URL | globalThis.Request,
291
- init?: RequestInit,
292
- ): Promise<Response>;
131
+ interface ReadWriteStream extends ReadableStream, WritableStream {}
293
132
 
294
- interface Request extends _Request {}
295
- var Request: typeof globalThis extends {
296
- onmessage: any;
297
- Request: infer T;
298
- } ? T
299
- : typeof import("undici-types").Request;
133
+ interface RefCounted {
134
+ ref(): this;
135
+ unref(): this;
136
+ }
300
137
 
301
- interface ResponseInit extends _ResponseInit {}
138
+ interface Dict<T> {
139
+ [key: string]: T | undefined;
140
+ }
302
141
 
303
- interface Response extends _Response {}
304
- var Response: typeof globalThis extends {
305
- onmessage: any;
306
- Response: infer T;
307
- } ? T
308
- : typeof import("undici-types").Response;
142
+ interface ReadOnlyDict<T> {
143
+ readonly [key: string]: T | undefined;
144
+ }
309
145
 
310
- interface FormData extends _FormData {}
311
- var FormData: typeof globalThis extends {
312
- onmessage: any;
313
- FormData: infer T;
314
- } ? T
315
- : typeof import("undici-types").FormData;
146
+ interface GCFunction {
147
+ (minor?: boolean): void;
148
+ (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
149
+ (options: NodeJS.GCOptions): void;
150
+ }
316
151
 
317
- interface Headers extends _Headers {}
318
- var Headers: typeof globalThis extends {
319
- onmessage: any;
320
- Headers: infer T;
321
- } ? T
322
- : typeof import("undici-types").Headers;
152
+ interface GCOptions {
153
+ execution?: "sync" | "async" | undefined;
154
+ flavor?: "regular" | "last-resort" | undefined;
155
+ type?: "major-snapshot" | "major" | "minor" | undefined;
156
+ filename?: string | undefined;
157
+ }
323
158
 
324
- interface MessageEvent extends _MessageEvent {}
325
- var MessageEvent: typeof globalThis extends {
326
- onmessage: any;
327
- MessageEvent: infer T;
328
- } ? T
329
- : typeof import("undici-types").MessageEvent;
159
+ /** An iterable iterator returned by the Node.js API. */
160
+ // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used IterableIterator.
161
+ interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
162
+ [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
163
+ }
330
164
 
331
- interface EventSource extends _EventSource {}
332
- var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
333
- : typeof import("undici-types").EventSource;
334
- // #endregion fetch
165
+ /** An async iterable iterator returned by the Node.js API. */
166
+ // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used AsyncIterableIterator.
167
+ interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
168
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
169
+ }
335
170
  }
node v20.19/index.d.ts CHANGED
@@ -36,6 +36,10 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="globals.d.ts" />
39
+ /// <reference path="web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="web-globals/domexception.d.ts" />
41
+ /// <reference path="web-globals/events.d.ts" />
42
+ /// <reference path="web-globals/fetch.d.ts" />
39
43
  /// <reference path="assert.d.ts" />
40
44
  /// <reference path="assert/strict.d.ts" />
41
45
  /// <reference path="async_hooks.d.ts" />
@@ -51,7 +55,6 @@
51
55
  /// <reference path="dns/promises.d.ts" />
52
56
  /// <reference path="dns/promises.d.ts" />
53
57
  /// <reference path="domain.d.ts" />
54
- /// <reference path="dom-events.d.ts" />
55
58
  /// <reference path="events.d.ts" />
56
59
  /// <reference path="fs.d.ts" />
57
60
  /// <reference path="fs/promises.d.ts" />
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.19.12",
3
+ "version": "20.19.14",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -135,6 +135,6 @@
135
135
  "undici-types": "~6.21.0"
136
136
  },
137
137
  "peerDependencies": {},
138
- "typesPublisherContentHash": "e97f4a4682123be9b4e445d0f7e8e1b48f871de9adb220058f56a0cc3e2f8824",
138
+ "typesPublisherContentHash": "6ac84123a6a7b62cc4d3d762a9ee1f3741f895c55e7d12f3ab6d33f170ee389c",
139
139
  "typeScriptVersion": "5.2"
140
140
  }
@@ -36,6 +36,10 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="../globals.d.ts" />
39
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="../web-globals/domexception.d.ts" />
41
+ /// <reference path="../web-globals/events.d.ts" />
42
+ /// <reference path="../web-globals/fetch.d.ts" />
39
43
  /// <reference path="../assert.d.ts" />
40
44
  /// <reference path="../assert/strict.d.ts" />
41
45
  /// <reference path="../async_hooks.d.ts" />
@@ -51,7 +55,6 @@
51
55
  /// <reference path="../dns/promises.d.ts" />
52
56
  /// <reference path="../dns/promises.d.ts" />
53
57
  /// <reference path="../domain.d.ts" />
54
- /// <reference path="../dom-events.d.ts" />
55
58
  /// <reference path="../events.d.ts" />
56
59
  /// <reference path="../fs.d.ts" />
57
60
  /// <reference path="../fs/promises.d.ts" />
@@ -0,0 +1,34 @@
1
+ export {};
2
+
3
+ type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
4
+ interface AbortController {
5
+ readonly signal: AbortSignal;
6
+ abort(reason?: any): void;
7
+ }
8
+
9
+ type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
10
+ interface AbortSignal extends EventTarget {
11
+ readonly aborted: boolean;
12
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
13
+ readonly reason: any;
14
+ throwIfAborted(): void;
15
+ }
16
+
17
+ declare global {
18
+ interface AbortController extends _AbortController {}
19
+ var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
20
+ : {
21
+ prototype: AbortController;
22
+ new(): AbortController;
23
+ };
24
+
25
+ interface AbortSignal extends _AbortSignal {}
26
+ var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
27
+ : {
28
+ prototype: AbortSignal;
29
+ new(): AbortSignal;
30
+ abort(reason?: any): AbortSignal;
31
+ any(signals: AbortSignal[]): AbortSignal;
32
+ timeout(milliseconds: number): AbortSignal;
33
+ };
34
+ }
@@ -0,0 +1,68 @@
1
+ export {};
2
+
3
+ type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
4
+ interface DOMException extends Error {
5
+ readonly code: number;
6
+ readonly message: string;
7
+ readonly name: string;
8
+ readonly INDEX_SIZE_ERR: 1;
9
+ readonly DOMSTRING_SIZE_ERR: 2;
10
+ readonly HIERARCHY_REQUEST_ERR: 3;
11
+ readonly WRONG_DOCUMENT_ERR: 4;
12
+ readonly INVALID_CHARACTER_ERR: 5;
13
+ readonly NO_DATA_ALLOWED_ERR: 6;
14
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
15
+ readonly NOT_FOUND_ERR: 8;
16
+ readonly NOT_SUPPORTED_ERR: 9;
17
+ readonly INUSE_ATTRIBUTE_ERR: 10;
18
+ readonly INVALID_STATE_ERR: 11;
19
+ readonly SYNTAX_ERR: 12;
20
+ readonly INVALID_MODIFICATION_ERR: 13;
21
+ readonly NAMESPACE_ERR: 14;
22
+ readonly INVALID_ACCESS_ERR: 15;
23
+ readonly VALIDATION_ERR: 16;
24
+ readonly TYPE_MISMATCH_ERR: 17;
25
+ readonly SECURITY_ERR: 18;
26
+ readonly NETWORK_ERR: 19;
27
+ readonly ABORT_ERR: 20;
28
+ readonly URL_MISMATCH_ERR: 21;
29
+ readonly QUOTA_EXCEEDED_ERR: 22;
30
+ readonly TIMEOUT_ERR: 23;
31
+ readonly INVALID_NODE_TYPE_ERR: 24;
32
+ readonly DATA_CLONE_ERR: 25;
33
+ }
34
+
35
+ declare global {
36
+ interface DOMException extends _DOMException {}
37
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
38
+ : {
39
+ prototype: DOMException;
40
+ new(message?: string, name?: string): DOMException;
41
+ new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
42
+ readonly INDEX_SIZE_ERR: 1;
43
+ readonly DOMSTRING_SIZE_ERR: 2;
44
+ readonly HIERARCHY_REQUEST_ERR: 3;
45
+ readonly WRONG_DOCUMENT_ERR: 4;
46
+ readonly INVALID_CHARACTER_ERR: 5;
47
+ readonly NO_DATA_ALLOWED_ERR: 6;
48
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
49
+ readonly NOT_FOUND_ERR: 8;
50
+ readonly NOT_SUPPORTED_ERR: 9;
51
+ readonly INUSE_ATTRIBUTE_ERR: 10;
52
+ readonly INVALID_STATE_ERR: 11;
53
+ readonly SYNTAX_ERR: 12;
54
+ readonly INVALID_MODIFICATION_ERR: 13;
55
+ readonly NAMESPACE_ERR: 14;
56
+ readonly INVALID_ACCESS_ERR: 15;
57
+ readonly VALIDATION_ERR: 16;
58
+ readonly TYPE_MISMATCH_ERR: 17;
59
+ readonly SECURITY_ERR: 18;
60
+ readonly NETWORK_ERR: 19;
61
+ readonly ABORT_ERR: 20;
62
+ readonly URL_MISMATCH_ERR: 21;
63
+ readonly QUOTA_EXCEEDED_ERR: 22;
64
+ readonly TIMEOUT_ERR: 23;
65
+ readonly INVALID_NODE_TYPE_ERR: 24;
66
+ readonly DATA_CLONE_ERR: 25;
67
+ };
68
+ }
@@ -1,37 +1,61 @@
1
- // Make this a module
2
1
  export {};
3
2
 
4
- // Conditional type aliases, which are later merged into the global scope.
5
- // Will either be empty if the relevant web library is already present, or the @types/node definition otherwise.
3
+ interface AddEventListenerOptions extends EventListenerOptions {
4
+ once?: boolean;
5
+ passive?: boolean;
6
+ signal?: AbortSignal;
7
+ }
6
8
 
7
- type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
9
+ type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
10
+ interface CustomEvent<T = any> extends Event {
11
+ readonly detail: T;
12
+ }
13
+
14
+ interface CustomEventInit<T = any> extends EventInit {
15
+ detail?: T;
16
+ }
17
+
18
+ type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
8
19
  interface Event {
9
20
  readonly bubbles: boolean;
10
21
  cancelBubble: boolean;
11
22
  readonly cancelable: boolean;
12
23
  readonly composed: boolean;
13
- composedPath(): [EventTarget?];
14
24
  readonly currentTarget: EventTarget | null;
15
25
  readonly defaultPrevented: boolean;
16
26
  readonly eventPhase: 0 | 2;
17
- initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
18
27
  readonly isTrusted: boolean;
19
- preventDefault(): void;
20
- readonly returnValue: boolean;
28
+ returnValue: boolean;
21
29
  readonly srcElement: EventTarget | null;
22
- stopImmediatePropagation(): void;
23
- stopPropagation(): void;
24
30
  readonly target: EventTarget | null;
25
31
  readonly timeStamp: number;
26
32
  readonly type: string;
33
+ composedPath(): [EventTarget?];
34
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
35
+ preventDefault(): void;
36
+ stopImmediatePropagation(): void;
37
+ stopPropagation(): void;
27
38
  }
28
39
 
29
- type __CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
30
- interface CustomEvent<T = any> extends Event {
31
- readonly detail: T;
40
+ interface EventInit {
41
+ bubbles?: boolean;
42
+ cancelable?: boolean;
43
+ composed?: boolean;
44
+ }
45
+
46
+ interface EventListener {
47
+ (evt: Event): void;
48
+ }
49
+
50
+ interface EventListenerObject {
51
+ handleEvent(object: Event): void;
52
+ }
53
+
54
+ interface EventListenerOptions {
55
+ capture?: boolean;
32
56
  }
33
57
 
34
- type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
58
+ type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
35
59
  interface EventTarget {
36
60
  addEventListener(
37
61
  type: string,
@@ -46,51 +70,22 @@ interface EventTarget {
46
70
  ): void;
47
71
  }
48
72
 
49
- interface EventInit {
50
- bubbles?: boolean;
51
- cancelable?: boolean;
52
- composed?: boolean;
53
- }
54
-
55
- interface CustomEventInit<T = any> extends EventInit {
56
- detail?: T;
57
- }
58
-
59
- interface EventListenerOptions {
60
- capture?: boolean;
61
- }
62
-
63
- interface AddEventListenerOptions extends EventListenerOptions {
64
- once?: boolean;
65
- passive?: boolean;
66
- signal?: AbortSignal;
67
- }
68
-
69
- interface EventListener {
70
- (evt: Event): void;
71
- }
72
-
73
- interface EventListenerObject {
74
- handleEvent(object: Event): void;
75
- }
76
-
77
- // Merge conditional interfaces into global scope, and conditionally declare global constructors.
78
73
  declare global {
79
- interface Event extends __Event {}
80
- var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
81
- : {
82
- prototype: Event;
83
- new(type: string, eventInitDict?: EventInit): Event;
84
- };
85
-
86
- interface CustomEvent<T = any> extends __CustomEvent<T> {}
74
+ interface CustomEvent<T = any> extends _CustomEvent<T> {}
87
75
  var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
88
76
  : {
89
77
  prototype: CustomEvent;
90
78
  new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
91
79
  };
92
80
 
93
- interface EventTarget extends __EventTarget {}
81
+ interface Event extends _Event {}
82
+ var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
83
+ : {
84
+ prototype: Event;
85
+ new(type: string, eventInitDict?: EventInit): Event;
86
+ };
87
+
88
+ interface EventTarget extends _EventTarget {}
94
89
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
95
90
  : {
96
91
  prototype: EventTarget;
@@ -0,0 +1,46 @@
1
+ export {};
2
+
3
+ import * as undici from "undici-types";
4
+
5
+ type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
6
+ type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
7
+ type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
8
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
9
+ type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
10
+ type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
11
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
12
+ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
13
+ type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
14
+
15
+ declare global {
16
+ function fetch(
17
+ input: string | URL | Request,
18
+ init?: RequestInit,
19
+ ): Promise<Response>;
20
+
21
+ interface EventSource extends _EventSource {}
22
+ var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
23
+
24
+ interface FormData extends _FormData {}
25
+ var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
26
+
27
+ interface Headers extends _Headers {}
28
+ var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
29
+
30
+ interface MessageEvent extends _MessageEvent {}
31
+ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
32
+ : typeof undici.MessageEvent;
33
+
34
+ interface Request extends _Request {}
35
+ var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
36
+
37
+ interface RequestInit extends _RequestInit {}
38
+
39
+ interface Response extends _Response {}
40
+ var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
41
+
42
+ interface ResponseInit extends _ResponseInit {}
43
+
44
+ interface WebSocket extends _WebSocket {}
45
+ var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
46
+ }
@@ -676,6 +676,24 @@ declare module "worker_threads" {
676
676
  * for the `key` will be deleted.
677
677
  */
678
678
  function setEnvironmentData(key: Serializable, value?: Serializable): void;
679
+ /**
680
+ * Sends a value to another worker, identified by its thread ID.
681
+ * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
682
+ * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
683
+ * @param value The value to send.
684
+ * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
685
+ * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
686
+ * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
687
+ * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
688
+ * @since v22.5.0
689
+ */
690
+ function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
691
+ function postMessageToThread(
692
+ threadId: number,
693
+ value: any,
694
+ transferList: readonly Transferable[],
695
+ timeout?: number,
696
+ ): Promise<void>;
679
697
 
680
698
  import {
681
699
  BroadcastChannel as _BroadcastChannel,