@types/node 18.19.123 → 18.19.125

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