@types/node 22.15.21 → 24.10.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/README.md +2 -2
- node/assert/strict.d.ts +105 -2
- node/assert.d.ts +162 -101
- node/async_hooks.d.ts +26 -6
- node/buffer.buffer.d.ts +9 -0
- node/buffer.d.ts +15 -7
- node/child_process.d.ts +91 -164
- node/cluster.d.ts +19 -20
- node/console.d.ts +19 -18
- node/crypto.d.ts +1264 -356
- node/dgram.d.ts +10 -9
- node/diagnostics_channel.d.ts +18 -15
- node/dns/promises.d.ts +36 -9
- node/dns.d.ts +95 -37
- node/domain.d.ts +1 -1
- node/events.d.ts +81 -36
- node/fs/promises.d.ts +104 -59
- node/fs.d.ts +414 -137
- node/globals.d.ts +149 -350
- node/globals.typedarray.d.ts +20 -0
- node/http.d.ts +187 -37
- node/http2.d.ts +266 -67
- node/https.d.ts +97 -63
- node/index.d.ts +16 -7
- node/inspector.d.ts +206 -3931
- node/inspector.generated.d.ts +4233 -0
- node/module.d.ts +153 -31
- node/net.d.ts +35 -16
- node/os.d.ts +22 -10
- node/package.json +14 -84
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +30 -18
- node/process.d.ts +40 -34
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline/promises.d.ts +1 -2
- node/readline.d.ts +13 -13
- node/repl.d.ts +25 -17
- node/sea.d.ts +10 -1
- node/sqlite.d.ts +438 -9
- node/stream/consumers.d.ts +2 -2
- node/stream/web.d.ts +13 -54
- node/stream.d.ts +68 -47
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +2034 -1975
- node/timers/promises.d.ts +1 -1
- node/timers.d.ts +1 -3
- node/tls.d.ts +124 -114
- node/trace_events.d.ts +6 -6
- node/ts5.6/buffer.buffer.d.ts +10 -2
- node/ts5.6/compatibility/float16array.d.ts +71 -0
- node/ts5.6/globals.typedarray.d.ts +17 -0
- node/ts5.6/index.d.ts +18 -7
- node/ts5.7/compatibility/float16array.d.ts +72 -0
- node/ts5.7/index.d.ts +103 -0
- node/tty.d.ts +1 -1
- node/url.d.ts +119 -34
- node/util.d.ts +46 -305
- node/v8.d.ts +100 -37
- node/vm.d.ts +299 -110
- node/wasi.d.ts +23 -2
- node/web-globals/abortcontroller.d.ts +34 -0
- node/web-globals/crypto.d.ts +32 -0
- node/web-globals/domexception.d.ts +68 -0
- node/web-globals/events.d.ts +97 -0
- node/web-globals/fetch.d.ts +50 -0
- node/web-globals/navigator.d.ts +25 -0
- node/web-globals/storage.d.ts +24 -0
- node/web-globals/streams.d.ts +22 -0
- node/worker_threads.d.ts +225 -75
- node/zlib.d.ts +44 -33
- node/compatibility/disposable.d.ts +0 -16
- node/compatibility/index.d.ts +0 -9
- node/compatibility/indexable.d.ts +0 -23
- node/dom-events.d.ts +0 -124
node/globals.d.ts
CHANGED
|
@@ -1,371 +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
|
-
// TODO: In next major @types/node version, change default TReturn to undefined.
|
|
255
|
-
interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
|
|
256
|
-
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
|
257
|
-
}
|
|
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
|
+
}
|
|
258
70
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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;
|
|
265
99
|
}
|
|
266
100
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
): T;
|
|
273
|
-
|
|
274
|
-
interface DOMException extends _DOMException {}
|
|
275
|
-
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
|
276
|
-
: NodeDOMExceptionConstructor;
|
|
277
|
-
|
|
278
|
-
// #region AbortController
|
|
279
|
-
interface AbortController {
|
|
280
|
-
readonly signal: AbortSignal;
|
|
281
|
-
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;
|
|
282
106
|
}
|
|
283
|
-
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
|
284
|
-
: {
|
|
285
|
-
prototype: AbortController;
|
|
286
|
-
new(): AbortController;
|
|
287
|
-
};
|
|
288
107
|
|
|
289
|
-
interface
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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>;
|
|
294
120
|
}
|
|
295
|
-
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
|
296
|
-
: {
|
|
297
|
-
prototype: AbortSignal;
|
|
298
|
-
new(): AbortSignal;
|
|
299
|
-
abort(reason?: any): AbortSignal;
|
|
300
|
-
any(signals: AbortSignal[]): AbortSignal;
|
|
301
|
-
timeout(milliseconds: number): AbortSignal;
|
|
302
|
-
};
|
|
303
|
-
// #endregion AbortController
|
|
304
|
-
|
|
305
|
-
// #region Storage
|
|
306
|
-
interface Storage extends _Storage {}
|
|
307
|
-
// Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker
|
|
308
|
-
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T
|
|
309
|
-
: {
|
|
310
|
-
prototype: Storage;
|
|
311
|
-
new(): Storage;
|
|
312
|
-
};
|
|
313
121
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
+
}
|
|
320
130
|
|
|
321
|
-
|
|
322
|
-
input: string | URL | globalThis.Request,
|
|
323
|
-
init?: RequestInit,
|
|
324
|
-
): Promise<Response>;
|
|
131
|
+
interface ReadWriteStream extends ReadableStream, WritableStream {}
|
|
325
132
|
|
|
326
|
-
interface
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
} ? T
|
|
331
|
-
: typeof import("undici-types").Request;
|
|
133
|
+
interface RefCounted {
|
|
134
|
+
ref(): this;
|
|
135
|
+
unref(): this;
|
|
136
|
+
}
|
|
332
137
|
|
|
333
|
-
interface
|
|
138
|
+
interface Dict<T> {
|
|
139
|
+
[key: string]: T | undefined;
|
|
140
|
+
}
|
|
334
141
|
|
|
335
|
-
interface
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
Response: infer T;
|
|
339
|
-
} ? T
|
|
340
|
-
: typeof import("undici-types").Response;
|
|
142
|
+
interface ReadOnlyDict<T> {
|
|
143
|
+
readonly [key: string]: T | undefined;
|
|
144
|
+
}
|
|
341
145
|
|
|
342
|
-
|
|
343
|
-
var FormData: typeof globalThis extends {
|
|
344
|
-
onmessage: any;
|
|
345
|
-
FormData: infer T;
|
|
346
|
-
} ? T
|
|
347
|
-
: typeof import("undici-types").FormData;
|
|
146
|
+
type PartialOptions<T> = { [K in keyof T]?: T[K] | undefined };
|
|
348
147
|
|
|
349
|
-
interface
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
: typeof import("undici-types").Headers;
|
|
148
|
+
interface GCFunction {
|
|
149
|
+
(minor?: boolean): void;
|
|
150
|
+
(options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
|
|
151
|
+
(options: NodeJS.GCOptions): void;
|
|
152
|
+
}
|
|
355
153
|
|
|
356
|
-
interface
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
154
|
+
interface GCOptions {
|
|
155
|
+
execution?: "sync" | "async" | undefined;
|
|
156
|
+
flavor?: "regular" | "last-resort" | undefined;
|
|
157
|
+
type?: "major-snapshot" | "major" | "minor" | undefined;
|
|
158
|
+
filename?: string | undefined;
|
|
159
|
+
}
|
|
362
160
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
:
|
|
161
|
+
/** An iterable iterator returned by the Node.js API. */
|
|
162
|
+
interface Iterator<T, TReturn = undefined, TNext = any> extends IteratorObject<T, TReturn, TNext> {
|
|
163
|
+
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
|
164
|
+
}
|
|
366
165
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
:
|
|
370
|
-
|
|
166
|
+
/** An async iterable iterator returned by the Node.js API. */
|
|
167
|
+
interface AsyncIterator<T, TReturn = undefined, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
|
|
168
|
+
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
|
|
169
|
+
}
|
|
371
170
|
}
|
node/globals.typedarray.d.ts
CHANGED
|
@@ -12,10 +12,30 @@ declare global {
|
|
|
12
12
|
| Int32Array<TArrayBuffer>
|
|
13
13
|
| BigUint64Array<TArrayBuffer>
|
|
14
14
|
| BigInt64Array<TArrayBuffer>
|
|
15
|
+
| Float16Array<TArrayBuffer>
|
|
15
16
|
| Float32Array<TArrayBuffer>
|
|
16
17
|
| Float64Array<TArrayBuffer>;
|
|
17
18
|
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
18
19
|
| TypedArray<TArrayBuffer>
|
|
19
20
|
| DataView<TArrayBuffer>;
|
|
21
|
+
|
|
22
|
+
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
|
|
23
|
+
// while maintaining compatibility with TS <=5.6.
|
|
24
|
+
// TODO: remove once @types/node no longer supports TS 5.6, and replace with native types.
|
|
25
|
+
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
|
|
26
|
+
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
|
|
27
|
+
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
|
|
28
|
+
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
|
|
29
|
+
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
|
|
30
|
+
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
|
|
31
|
+
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
|
|
32
|
+
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
|
|
33
|
+
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
|
|
34
|
+
type NonSharedFloat16Array = Float16Array<ArrayBuffer>;
|
|
35
|
+
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
|
|
36
|
+
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
|
|
37
|
+
type NonSharedDataView = DataView<ArrayBuffer>;
|
|
38
|
+
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
|
|
39
|
+
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
|
|
20
40
|
}
|
|
21
41
|
}
|