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