@types/node 24.3.0 → 24.3.2

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/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.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 15 Aug 2025 08:39:32 GMT
11
+ * Last updated: Fri, 12 Sep 2025 19:32:39 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/globals.d.ts CHANGED
@@ -1,367 +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 (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
- type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").CloseEvent;
18
- // #endregion Fetch and friends
19
-
20
- // Conditional type definitions for webstorage interface, which conflicts with lib.dom otherwise.
21
- type _Storage = typeof globalThis extends { onabort: any } ? {} : {
22
- readonly length: number;
23
- clear(): void;
24
- getItem(key: string): string | null;
25
- key(index: number): string | null;
26
- removeItem(key: string): void;
27
- setItem(key: string, value: string): void;
28
- [key: string]: any;
29
- };
30
-
31
- // #region DOMException
32
- type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
33
- interface NodeDOMException extends Error {
34
- readonly code: number;
35
- readonly message: string;
36
- readonly name: string;
37
- readonly INDEX_SIZE_ERR: 1;
38
- readonly DOMSTRING_SIZE_ERR: 2;
39
- readonly HIERARCHY_REQUEST_ERR: 3;
40
- readonly WRONG_DOCUMENT_ERR: 4;
41
- readonly INVALID_CHARACTER_ERR: 5;
42
- readonly NO_DATA_ALLOWED_ERR: 6;
43
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
44
- readonly NOT_FOUND_ERR: 8;
45
- readonly NOT_SUPPORTED_ERR: 9;
46
- readonly INUSE_ATTRIBUTE_ERR: 10;
47
- readonly INVALID_STATE_ERR: 11;
48
- readonly SYNTAX_ERR: 12;
49
- readonly INVALID_MODIFICATION_ERR: 13;
50
- readonly NAMESPACE_ERR: 14;
51
- readonly INVALID_ACCESS_ERR: 15;
52
- readonly VALIDATION_ERR: 16;
53
- readonly TYPE_MISMATCH_ERR: 17;
54
- readonly SECURITY_ERR: 18;
55
- readonly NETWORK_ERR: 19;
56
- readonly ABORT_ERR: 20;
57
- readonly URL_MISMATCH_ERR: 21;
58
- readonly QUOTA_EXCEEDED_ERR: 22;
59
- readonly TIMEOUT_ERR: 23;
60
- readonly INVALID_NODE_TYPE_ERR: 24;
61
- readonly DATA_CLONE_ERR: 25;
62
- }
63
- interface NodeDOMExceptionConstructor {
64
- prototype: DOMException;
65
- new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
66
- readonly INDEX_SIZE_ERR: 1;
67
- readonly DOMSTRING_SIZE_ERR: 2;
68
- readonly HIERARCHY_REQUEST_ERR: 3;
69
- readonly WRONG_DOCUMENT_ERR: 4;
70
- readonly INVALID_CHARACTER_ERR: 5;
71
- readonly NO_DATA_ALLOWED_ERR: 6;
72
- readonly NO_MODIFICATION_ALLOWED_ERR: 7;
73
- readonly NOT_FOUND_ERR: 8;
74
- readonly NOT_SUPPORTED_ERR: 9;
75
- readonly INUSE_ATTRIBUTE_ERR: 10;
76
- readonly INVALID_STATE_ERR: 11;
77
- readonly SYNTAX_ERR: 12;
78
- readonly INVALID_MODIFICATION_ERR: 13;
79
- readonly NAMESPACE_ERR: 14;
80
- readonly INVALID_ACCESS_ERR: 15;
81
- readonly VALIDATION_ERR: 16;
82
- readonly TYPE_MISMATCH_ERR: 17;
83
- readonly SECURITY_ERR: 18;
84
- readonly NETWORK_ERR: 19;
85
- readonly ABORT_ERR: 20;
86
- readonly URL_MISMATCH_ERR: 21;
87
- readonly QUOTA_EXCEEDED_ERR: 22;
88
- readonly TIMEOUT_ERR: 23;
89
- readonly INVALID_NODE_TYPE_ERR: 24;
90
- readonly DATA_CLONE_ERR: 25;
91
- }
92
- // #endregion DOMException
93
-
94
- declare global {
95
- var global: typeof globalThis;
96
-
97
- var process: NodeJS.Process;
98
- var console: Console;
99
-
100
- interface ErrorConstructor {
101
- /**
102
- * Creates a `.stack` property on `targetObject`, which when accessed returns
103
- * a string representing the location in the code at which
104
- * `Error.captureStackTrace()` was called.
105
- *
106
- * ```js
107
- * const myObject = {};
108
- * Error.captureStackTrace(myObject);
109
- * myObject.stack; // Similar to `new Error().stack`
110
- * ```
111
- *
112
- * The first line of the trace will be prefixed with
113
- * `${myObject.name}: ${myObject.message}`.
114
- *
115
- * The optional `constructorOpt` argument accepts a function. If given, all frames
116
- * above `constructorOpt`, including `constructorOpt`, will be omitted from the
117
- * generated stack trace.
118
- *
119
- * The `constructorOpt` argument is useful for hiding implementation
120
- * details of error generation from the user. For instance:
121
- *
122
- * ```js
123
- * function a() {
124
- * b();
125
- * }
126
- *
127
- * function b() {
128
- * c();
129
- * }
130
- *
131
- * function c() {
132
- * // Create an error without stack trace to avoid calculating the stack trace twice.
133
- * const { stackTraceLimit } = Error;
134
- * Error.stackTraceLimit = 0;
135
- * const error = new Error();
136
- * Error.stackTraceLimit = stackTraceLimit;
137
- *
138
- * // Capture the stack trace above function b
139
- * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
140
- * throw error;
141
- * }
142
- *
143
- * a();
144
- * ```
145
- */
146
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
147
- /**
148
- * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
149
- */
150
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
151
- /**
152
- * The `Error.stackTraceLimit` property specifies the number of stack frames
153
- * collected by a stack trace (whether generated by `new Error().stack` or
154
- * `Error.captureStackTrace(obj)`).
155
- *
156
- * The default value is `10` but may be set to any valid JavaScript number. Changes
157
- * will affect any stack trace captured _after_ the value has been changed.
158
- *
159
- * If set to a non-number value, or set to a negative number, stack traces will
160
- * not capture any frames.
161
- */
162
- stackTraceLimit: number;
163
- }
3
+ declare var process: NodeJS.Process;
4
+ declare var console: Console;
164
5
 
6
+ interface ErrorConstructor {
165
7
  /**
166
- * 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
+ * ```
167
51
  */
168
- var gc: NodeJS.GCFunction | undefined;
169
-
170
- namespace NodeJS {
171
- interface CallSite {
172
- getColumnNumber(): number | null;
173
- getEnclosingColumnNumber(): number | null;
174
- getEnclosingLineNumber(): number | null;
175
- getEvalOrigin(): string | undefined;
176
- getFileName(): string | null;
177
- getFunction(): Function | undefined;
178
- getFunctionName(): string | null;
179
- getLineNumber(): number | null;
180
- getMethodName(): string | null;
181
- getPosition(): number;
182
- getPromiseIndex(): number | null;
183
- getScriptHash(): string;
184
- getScriptNameOrSourceURL(): string | null;
185
- getThis(): unknown;
186
- getTypeName(): string | null;
187
- isAsync(): boolean;
188
- isConstructor(): boolean;
189
- isEval(): boolean;
190
- isNative(): boolean;
191
- isPromiseAll(): boolean;
192
- isToplevel(): boolean;
193
- }
194
-
195
- interface ErrnoException extends Error {
196
- errno?: number | undefined;
197
- code?: string | undefined;
198
- path?: string | undefined;
199
- syscall?: string | undefined;
200
- }
201
-
202
- interface ReadableStream extends EventEmitter {
203
- readable: boolean;
204
- read(size?: number): string | Buffer;
205
- setEncoding(encoding: BufferEncoding): this;
206
- pause(): this;
207
- resume(): this;
208
- isPaused(): boolean;
209
- pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
210
- unpipe(destination?: WritableStream): this;
211
- unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
212
- wrap(oldStream: ReadableStream): this;
213
- [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
214
- }
215
-
216
- interface WritableStream extends EventEmitter {
217
- writable: boolean;
218
- write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
219
- write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
220
- end(cb?: () => void): this;
221
- end(data: string | Uint8Array, cb?: () => void): this;
222
- end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
223
- }
224
-
225
- interface ReadWriteStream extends ReadableStream, WritableStream {}
226
-
227
- interface RefCounted {
228
- ref(): this;
229
- unref(): this;
230
- }
231
-
232
- interface Dict<T> {
233
- [key: string]: T | undefined;
234
- }
235
-
236
- interface ReadOnlyDict<T> {
237
- readonly [key: string]: T | undefined;
238
- }
239
-
240
- interface GCFunction {
241
- (minor?: boolean): void;
242
- (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
243
- (options: NodeJS.GCOptions): void;
244
- }
245
-
246
- interface GCOptions {
247
- execution?: "sync" | "async" | undefined;
248
- flavor?: "regular" | "last-resort" | undefined;
249
- type?: "major-snapshot" | "major" | "minor" | undefined;
250
- filename?: string | undefined;
251
- }
252
-
253
- /** An iterable iterator returned by the Node.js API. */
254
- interface Iterator<T, TReturn = undefined, TNext = any> extends IteratorObject<T, TReturn, TNext> {
255
- [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
256
- }
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
+ }
257
70
 
258
- /** An async iterable iterator returned by the Node.js API. */
259
- interface AsyncIterator<T, TReturn = undefined, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
260
- [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
261
- }
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;
262
99
  }
263
100
 
264
- // Global DOM types
265
-
266
- interface DOMException extends _DOMException {}
267
- var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
268
- : NodeDOMExceptionConstructor;
269
-
270
- // #region AbortController
271
- interface AbortController {
272
- readonly signal: AbortSignal;
273
- 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;
274
106
  }
275
- var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
276
- : {
277
- prototype: AbortController;
278
- new(): AbortController;
279
- };
280
107
 
281
- interface AbortSignal extends EventTarget {
282
- readonly aborted: boolean;
283
- onabort: ((this: AbortSignal, ev: Event) => any) | null;
284
- readonly reason: any;
285
- 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>;
286
120
  }
287
- var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
288
- : {
289
- prototype: AbortSignal;
290
- new(): AbortSignal;
291
- abort(reason?: any): AbortSignal;
292
- any(signals: AbortSignal[]): AbortSignal;
293
- timeout(milliseconds: number): AbortSignal;
294
- };
295
- // #endregion AbortController
296
-
297
- // #region Storage
298
- interface Storage extends _Storage {}
299
- // Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker
300
- var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T
301
- : {
302
- prototype: Storage;
303
- new(): Storage;
304
- };
305
-
306
- var localStorage: Storage;
307
- var sessionStorage: Storage;
308
- // #endregion Storage
309
-
310
- // #region fetch
311
- interface RequestInit extends _RequestInit {}
312
121
 
313
- function fetch(
314
- input: string | URL | globalThis.Request,
315
- init?: RequestInit,
316
- ): Promise<Response>;
317
-
318
- interface Request extends _Request {}
319
- var Request: typeof globalThis extends {
320
- onmessage: any;
321
- Request: infer T;
322
- } ? T
323
- : typeof import("undici-types").Request;
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
+ }
324
130
 
325
- interface ResponseInit extends _ResponseInit {}
131
+ interface ReadWriteStream extends ReadableStream, WritableStream {}
326
132
 
327
- interface Response extends _Response {}
328
- var Response: typeof globalThis extends {
329
- onmessage: any;
330
- Response: infer T;
331
- } ? T
332
- : typeof import("undici-types").Response;
133
+ interface RefCounted {
134
+ ref(): this;
135
+ unref(): this;
136
+ }
333
137
 
334
- interface FormData extends _FormData {}
335
- var FormData: typeof globalThis extends {
336
- onmessage: any;
337
- FormData: infer T;
338
- } ? T
339
- : typeof import("undici-types").FormData;
138
+ interface Dict<T> {
139
+ [key: string]: T | undefined;
140
+ }
340
141
 
341
- interface Headers extends _Headers {}
342
- var Headers: typeof globalThis extends {
343
- onmessage: any;
344
- Headers: infer T;
345
- } ? T
346
- : typeof import("undici-types").Headers;
142
+ interface ReadOnlyDict<T> {
143
+ readonly [key: string]: T | undefined;
144
+ }
347
145
 
348
- interface MessageEvent extends _MessageEvent {}
349
- var MessageEvent: typeof globalThis extends {
350
- onmessage: any;
351
- MessageEvent: infer T;
352
- } ? T
353
- : typeof import("undici-types").MessageEvent;
146
+ interface GCFunction {
147
+ (minor?: boolean): void;
148
+ (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
149
+ (options: NodeJS.GCOptions): void;
150
+ }
354
151
 
355
- interface WebSocket extends _WebSocket {}
356
- var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T
357
- : typeof import("undici-types").WebSocket;
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
+ }
358
158
 
359
- interface EventSource extends _EventSource {}
360
- var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
361
- : typeof import("undici-types").EventSource;
159
+ /** An iterable iterator returned by the Node.js API. */
160
+ interface Iterator<T, TReturn = undefined, TNext = any> extends IteratorObject<T, TReturn, TNext> {
161
+ [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
162
+ }
362
163
 
363
- interface CloseEvent extends _CloseEvent {}
364
- var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T
365
- : typeof import("undici-types").CloseEvent;
366
- // #endregion fetch
164
+ /** An async iterable iterator returned by the Node.js API. */
165
+ interface AsyncIterator<T, TReturn = undefined, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
166
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
167
+ }
367
168
  }
node/http.d.ts CHANGED
@@ -2031,15 +2031,15 @@ declare module "http" {
2031
2031
  * A browser-compatible implementation of [WebSocket](https://nodejs.org/docs/latest/api/http.html#websocket).
2032
2032
  * @since v22.5.0
2033
2033
  */
2034
- const WebSocket: import("undici-types").WebSocket;
2034
+ const WebSocket: typeof import("undici-types").WebSocket;
2035
2035
  /**
2036
2036
  * @since v22.5.0
2037
2037
  */
2038
- const CloseEvent: import("undici-types").CloseEvent;
2038
+ const CloseEvent: typeof import("undici-types").CloseEvent;
2039
2039
  /**
2040
2040
  * @since v22.5.0
2041
2041
  */
2042
- const MessageEvent: import("undici-types").MessageEvent;
2042
+ const MessageEvent: typeof import("undici-types").MessageEvent;
2043
2043
  }
2044
2044
  declare module "node:http" {
2045
2045
  export * from "http";
node/index.d.ts CHANGED
@@ -38,6 +38,12 @@
38
38
 
39
39
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
40
40
  /// <reference path="globals.d.ts" />
41
+ /// <reference path="web-globals/abortcontroller.d.ts" />
42
+ /// <reference path="web-globals/domexception.d.ts" />
43
+ /// <reference path="web-globals/events.d.ts" />
44
+ /// <reference path="web-globals/fetch.d.ts" />
45
+ /// <reference path="web-globals/navigator.d.ts" />
46
+ /// <reference path="web-globals/storage.d.ts" />
41
47
  /// <reference path="assert.d.ts" />
42
48
  /// <reference path="assert/strict.d.ts" />
43
49
  /// <reference path="async_hooks.d.ts" />
@@ -53,7 +59,6 @@
53
59
  /// <reference path="dns/promises.d.ts" />
54
60
  /// <reference path="dns/promises.d.ts" />
55
61
  /// <reference path="domain.d.ts" />
56
- /// <reference path="dom-events.d.ts" />
57
62
  /// <reference path="events.d.ts" />
58
63
  /// <reference path="fs.d.ts" />
59
64
  /// <reference path="fs/promises.d.ts" />
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "24.3.0",
3
+ "version": "24.3.2",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -150,6 +150,6 @@
150
150
  "undici-types": "~7.10.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "1db0510763ba3afd8e54c0591e60a100a7b90926f5d7da28ae32d8f845d725da",
153
+ "typesPublisherContentHash": "51e862b120094aacc736611dfd6c115dca5d946c4391105b5149da165827bf5b",
154
154
  "typeScriptVersion": "5.2"
155
155
  }
node/ts5.6/index.d.ts CHANGED
@@ -40,6 +40,12 @@
40
40
 
41
41
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
42
42
  /// <reference path="../globals.d.ts" />
43
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
44
+ /// <reference path="../web-globals/domexception.d.ts" />
45
+ /// <reference path="../web-globals/events.d.ts" />
46
+ /// <reference path="../web-globals/fetch.d.ts" />
47
+ /// <reference path="../web-globals/navigator.d.ts" />
48
+ /// <reference path="../web-globals/storage.d.ts" />
43
49
  /// <reference path="../assert.d.ts" />
44
50
  /// <reference path="../assert/strict.d.ts" />
45
51
  /// <reference path="../async_hooks.d.ts" />
@@ -55,7 +61,6 @@
55
61
  /// <reference path="../dns/promises.d.ts" />
56
62
  /// <reference path="../dns/promises.d.ts" />
57
63
  /// <reference path="../domain.d.ts" />
58
- /// <reference path="../dom-events.d.ts" />
59
64
  /// <reference path="../events.d.ts" />
60
65
  /// <reference path="../fs.d.ts" />
61
66
  /// <reference path="../fs/promises.d.ts" />
node/ts5.7/index.d.ts CHANGED
@@ -40,6 +40,12 @@
40
40
 
41
41
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
42
42
  /// <reference path="../globals.d.ts" />
43
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
44
+ /// <reference path="../web-globals/domexception.d.ts" />
45
+ /// <reference path="../web-globals/events.d.ts" />
46
+ /// <reference path="../web-globals/fetch.d.ts" />
47
+ /// <reference path="../web-globals/navigator.d.ts" />
48
+ /// <reference path="../web-globals/storage.d.ts" />
43
49
  /// <reference path="../assert.d.ts" />
44
50
  /// <reference path="../assert/strict.d.ts" />
45
51
  /// <reference path="../async_hooks.d.ts" />
@@ -55,7 +61,6 @@
55
61
  /// <reference path="../dns/promises.d.ts" />
56
62
  /// <reference path="../dns/promises.d.ts" />
57
63
  /// <reference path="../domain.d.ts" />
58
- /// <reference path="../dom-events.d.ts" />
59
64
  /// <reference path="../events.d.ts" />
60
65
  /// <reference path="../fs.d.ts" />
61
66
  /// <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,50 @@
1
+ export {};
2
+
3
+ import * as undici from "undici-types";
4
+
5
+ type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEvent;
6
+ type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
7
+ type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
8
+ type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
9
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
10
+ type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
11
+ type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
12
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
13
+ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
14
+ type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
15
+
16
+ declare global {
17
+ function fetch(
18
+ input: string | URL | Request,
19
+ init?: RequestInit,
20
+ ): Promise<Response>;
21
+
22
+ interface CloseEvent extends _CloseEvent {}
23
+ var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T : typeof undici.CloseEvent;
24
+
25
+ interface EventSource extends _EventSource {}
26
+ var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
27
+
28
+ interface FormData extends _FormData {}
29
+ var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
30
+
31
+ interface Headers extends _Headers {}
32
+ var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
33
+
34
+ interface MessageEvent extends _MessageEvent {}
35
+ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
36
+ : typeof undici.MessageEvent;
37
+
38
+ interface Request extends _Request {}
39
+ var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
40
+
41
+ interface RequestInit extends _RequestInit {}
42
+
43
+ interface Response extends _Response {}
44
+ var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
45
+
46
+ interface ResponseInit extends _ResponseInit {}
47
+
48
+ interface WebSocket extends _WebSocket {}
49
+ var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
50
+ }
@@ -0,0 +1,22 @@
1
+ export {};
2
+
3
+ // lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
4
+ type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
5
+ interface Navigator {
6
+ readonly hardwareConcurrency: number;
7
+ readonly language: string;
8
+ readonly languages: readonly string[];
9
+ readonly platform: string;
10
+ readonly userAgent: string;
11
+ }
12
+
13
+ declare global {
14
+ interface Navigator extends _Navigator {}
15
+ var Navigator: typeof globalThis extends { onabort: any; Navigator: infer T } ? T : {
16
+ prototype: Navigator;
17
+ new(): Navigator;
18
+ };
19
+
20
+ // Needs conditional inference for lib.dom and lib.webworker compatibility
21
+ var navigator: typeof globalThis extends { onmessage: any; navigator: infer T } ? T : Navigator;
22
+ }
@@ -0,0 +1,24 @@
1
+ export {};
2
+
3
+ // These interfaces are absent from lib.webworker, so the conditionals use `onabort` rather than `onmessage`
4
+ type _Storage = typeof globalThis extends { onabort: any } ? {} : Storage;
5
+ interface Storage {
6
+ readonly length: number;
7
+ clear(): void;
8
+ getItem(key: string): string | null;
9
+ key(index: number): string | null;
10
+ removeItem(key: string): void;
11
+ setItem(key: string, value: string): void;
12
+ [key: string]: any;
13
+ }
14
+
15
+ declare global {
16
+ interface Storage extends _Storage {}
17
+ var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T : {
18
+ prototype: Storage;
19
+ new(): Storage;
20
+ };
21
+
22
+ var localStorage: Storage;
23
+ var sessionStorage: Storage;
24
+ }