@types/node 22.5.1 → 22.5.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 +1 -1
- node/buffer.d.ts +17 -10
- node/globals.d.ts +93 -8
- node/package.json +2 -2
- node/stream/web.d.ts +262 -23
- node/test.d.ts +21 -12
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:
|
11
|
+
* Last updated: Sun, 01 Sep 2024 12:10:27 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/buffer.d.ts
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
|
2
|
+
// Otherwise, use the types from node.
|
3
|
+
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
|
4
|
+
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
|
5
|
+
|
1
6
|
/**
|
2
7
|
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
3
8
|
* Node.js APIs support `Buffer`s.
|
@@ -232,10 +237,7 @@ declare module "buffer" {
|
|
232
237
|
}
|
233
238
|
export import atob = globalThis.atob;
|
234
239
|
export import btoa = globalThis.btoa;
|
235
|
-
|
236
|
-
// This conditional type will be the existing global Blob in a browser, or
|
237
|
-
// the copy below in a Node environment.
|
238
|
-
type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
|
240
|
+
|
239
241
|
global {
|
240
242
|
namespace NodeJS {
|
241
243
|
export { BufferEncoding };
|
@@ -2275,17 +2277,22 @@ declare module "buffer" {
|
|
2275
2277
|
* @param data An ASCII (Latin1) string.
|
2276
2278
|
*/
|
2277
2279
|
function btoa(data: string): string;
|
2278
|
-
interface Blob extends
|
2280
|
+
interface Blob extends _Blob {}
|
2279
2281
|
/**
|
2280
2282
|
* `Blob` class is a global reference for `require('node:buffer').Blob`
|
2281
2283
|
* https://nodejs.org/api/buffer.html#class-blob
|
2282
2284
|
* @since v18.0.0
|
2283
2285
|
*/
|
2284
|
-
var Blob: typeof globalThis extends {
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2286
|
+
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
|
2287
|
+
: typeof import("buffer").Blob;
|
2288
|
+
interface File extends _File {}
|
2289
|
+
/**
|
2290
|
+
* `File` class is a global reference for `require('node:buffer').File`
|
2291
|
+
* https://nodejs.org/api/buffer.html#class-file
|
2292
|
+
* @since v20.0.0
|
2293
|
+
*/
|
2294
|
+
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
|
2295
|
+
: typeof import("buffer").File;
|
2289
2296
|
}
|
2290
2297
|
}
|
2291
2298
|
declare module "node:buffer" {
|
node/globals.d.ts
CHANGED
@@ -12,7 +12,6 @@ type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
|
|
12
12
|
: import("undici-types").RequestInit;
|
13
13
|
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
|
14
14
|
: import("undici-types").ResponseInit;
|
15
|
-
type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
|
16
15
|
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").WebSocket;
|
17
16
|
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
|
18
17
|
// #endregion Fetch and friends
|
@@ -60,6 +59,76 @@ type _Storage = typeof globalThis extends { onabort: any } ? {} : {
|
|
60
59
|
[key: string]: any;
|
61
60
|
};
|
62
61
|
|
62
|
+
// #region DOMException
|
63
|
+
type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
|
64
|
+
interface NodeDOMException extends Error {
|
65
|
+
/**
|
66
|
+
* @deprecated
|
67
|
+
*
|
68
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
|
69
|
+
*/
|
70
|
+
readonly code: number;
|
71
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
|
72
|
+
readonly message: string;
|
73
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
|
74
|
+
readonly name: string;
|
75
|
+
readonly INDEX_SIZE_ERR: 1;
|
76
|
+
readonly DOMSTRING_SIZE_ERR: 2;
|
77
|
+
readonly HIERARCHY_REQUEST_ERR: 3;
|
78
|
+
readonly WRONG_DOCUMENT_ERR: 4;
|
79
|
+
readonly INVALID_CHARACTER_ERR: 5;
|
80
|
+
readonly NO_DATA_ALLOWED_ERR: 6;
|
81
|
+
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
82
|
+
readonly NOT_FOUND_ERR: 8;
|
83
|
+
readonly NOT_SUPPORTED_ERR: 9;
|
84
|
+
readonly INUSE_ATTRIBUTE_ERR: 10;
|
85
|
+
readonly INVALID_STATE_ERR: 11;
|
86
|
+
readonly SYNTAX_ERR: 12;
|
87
|
+
readonly INVALID_MODIFICATION_ERR: 13;
|
88
|
+
readonly NAMESPACE_ERR: 14;
|
89
|
+
readonly INVALID_ACCESS_ERR: 15;
|
90
|
+
readonly VALIDATION_ERR: 16;
|
91
|
+
readonly TYPE_MISMATCH_ERR: 17;
|
92
|
+
readonly SECURITY_ERR: 18;
|
93
|
+
readonly NETWORK_ERR: 19;
|
94
|
+
readonly ABORT_ERR: 20;
|
95
|
+
readonly URL_MISMATCH_ERR: 21;
|
96
|
+
readonly QUOTA_EXCEEDED_ERR: 22;
|
97
|
+
readonly TIMEOUT_ERR: 23;
|
98
|
+
readonly INVALID_NODE_TYPE_ERR: 24;
|
99
|
+
readonly DATA_CLONE_ERR: 25;
|
100
|
+
}
|
101
|
+
interface NodeDOMExceptionConstructor {
|
102
|
+
prototype: DOMException;
|
103
|
+
new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
|
104
|
+
readonly INDEX_SIZE_ERR: 1;
|
105
|
+
readonly DOMSTRING_SIZE_ERR: 2;
|
106
|
+
readonly HIERARCHY_REQUEST_ERR: 3;
|
107
|
+
readonly WRONG_DOCUMENT_ERR: 4;
|
108
|
+
readonly INVALID_CHARACTER_ERR: 5;
|
109
|
+
readonly NO_DATA_ALLOWED_ERR: 6;
|
110
|
+
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
111
|
+
readonly NOT_FOUND_ERR: 8;
|
112
|
+
readonly NOT_SUPPORTED_ERR: 9;
|
113
|
+
readonly INUSE_ATTRIBUTE_ERR: 10;
|
114
|
+
readonly INVALID_STATE_ERR: 11;
|
115
|
+
readonly SYNTAX_ERR: 12;
|
116
|
+
readonly INVALID_MODIFICATION_ERR: 13;
|
117
|
+
readonly NAMESPACE_ERR: 14;
|
118
|
+
readonly INVALID_ACCESS_ERR: 15;
|
119
|
+
readonly VALIDATION_ERR: 16;
|
120
|
+
readonly TYPE_MISMATCH_ERR: 17;
|
121
|
+
readonly SECURITY_ERR: 18;
|
122
|
+
readonly NETWORK_ERR: 19;
|
123
|
+
readonly ABORT_ERR: 20;
|
124
|
+
readonly URL_MISMATCH_ERR: 21;
|
125
|
+
readonly QUOTA_EXCEEDED_ERR: 22;
|
126
|
+
readonly TIMEOUT_ERR: 23;
|
127
|
+
readonly INVALID_NODE_TYPE_ERR: 24;
|
128
|
+
readonly DATA_CLONE_ERR: 25;
|
129
|
+
}
|
130
|
+
// #endregion DOMException
|
131
|
+
|
63
132
|
declare global {
|
64
133
|
// Declare "static" methods in Error
|
65
134
|
interface ErrorConstructor {
|
@@ -237,6 +306,24 @@ declare global {
|
|
237
306
|
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
|
238
307
|
): T;
|
239
308
|
|
309
|
+
// #region DOMException
|
310
|
+
/**
|
311
|
+
* @since v17.0.0
|
312
|
+
* An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
|
313
|
+
*
|
314
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
|
315
|
+
*/
|
316
|
+
interface DOMException extends _DOMException {}
|
317
|
+
|
318
|
+
/**
|
319
|
+
* @since v17.0.0
|
320
|
+
*
|
321
|
+
* The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details.
|
322
|
+
*/
|
323
|
+
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
324
|
+
: NodeDOMExceptionConstructor;
|
325
|
+
// #endregion DOMException
|
326
|
+
|
240
327
|
/*----------------------------------------------*
|
241
328
|
* *
|
242
329
|
* GLOBAL INTERFACES *
|
@@ -484,19 +571,15 @@ declare global {
|
|
484
571
|
: typeof import("undici-types").Headers;
|
485
572
|
|
486
573
|
interface MessageEvent extends _MessageEvent {}
|
574
|
+
/**
|
575
|
+
* @since v15.0.0
|
576
|
+
*/
|
487
577
|
var MessageEvent: typeof globalThis extends {
|
488
578
|
onmessage: any;
|
489
579
|
MessageEvent: infer T;
|
490
580
|
} ? T
|
491
581
|
: typeof import("undici-types").MessageEvent;
|
492
582
|
|
493
|
-
interface File extends _File {}
|
494
|
-
var File: typeof globalThis extends {
|
495
|
-
onmessage: any;
|
496
|
-
File: infer T;
|
497
|
-
} ? T
|
498
|
-
: typeof import("node:buffer").File;
|
499
|
-
|
500
583
|
interface WebSocket extends _WebSocket {}
|
501
584
|
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T
|
502
585
|
: typeof import("undici-types").WebSocket;
|
@@ -504,6 +587,8 @@ declare global {
|
|
504
587
|
interface EventSource extends _EventSource {}
|
505
588
|
/**
|
506
589
|
* Only available through the [--experimental-eventsource](https://nodejs.org/api/cli.html#--experimental-eventsource) flag.
|
590
|
+
*
|
591
|
+
* @since v22.3.0
|
507
592
|
*/
|
508
593
|
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
|
509
594
|
: typeof import("undici-types").EventSource;
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.5.
|
3
|
+
"version": "22.5.2",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "6ee9a11eba834031423800320320aa873d6bf2b6f33603c13a2aa9d90b3803ee",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|
node/stream/web.d.ts
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
2
|
+
: import("stream/web").ByteLengthQueuingStrategy;
|
3
|
+
type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
4
|
+
: import("stream/web").CompressionStream;
|
5
|
+
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
6
|
+
: import("stream/web").CountQueuingStrategy;
|
7
|
+
type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
8
|
+
: import("stream/web").DecompressionStream;
|
9
|
+
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
10
|
+
: import("stream/web").ReadableByteStreamController;
|
11
|
+
type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
12
|
+
: import("stream/web").ReadableStream<R>;
|
13
|
+
type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {}
|
14
|
+
: import("stream/web").ReadableStreamBYOBReader;
|
15
|
+
type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {}
|
16
|
+
: import("stream/web").ReadableStreamBYOBRequest;
|
17
|
+
type _ReadableStreamDefaultController<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
18
|
+
: import("stream/web").ReadableStreamDefaultController<R>;
|
19
|
+
type _ReadableStreamDefaultReader<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
20
|
+
: import("stream/web").ReadableStreamDefaultReader<R>;
|
21
|
+
type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {}
|
22
|
+
: import("stream/web").TextDecoderStream;
|
23
|
+
type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {}
|
24
|
+
: import("stream/web").TextEncoderStream;
|
25
|
+
type _TransformStream<I = any, O = any> = typeof globalThis extends { onmessage: any } ? {}
|
26
|
+
: import("stream/web").TransformStream<I, O>;
|
27
|
+
type _TransformStreamDefaultController<O = any> = typeof globalThis extends { onmessage: any } ? {}
|
28
|
+
: import("stream/web").TransformStreamDefaultController<O>;
|
29
|
+
type _WritableStream<W = any> = typeof globalThis extends { onmessage: any } ? {}
|
30
|
+
: import("stream/web").WritableStream<W>;
|
31
|
+
type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {}
|
32
|
+
: import("stream/web").WritableStreamDefaultController;
|
33
|
+
type _WritableStreamDefaultWriter<W = any> = typeof globalThis extends { onmessage: any } ? {}
|
34
|
+
: import("stream/web").WritableStreamDefaultWriter<W>;
|
35
|
+
|
1
36
|
declare module "stream/web" {
|
2
37
|
// stub module, pending copy&paste from .d.ts or manual impl
|
3
38
|
// copy from lib.dom.d.ts
|
@@ -65,18 +100,7 @@ declare module "stream/web" {
|
|
65
100
|
readonly closed: Promise<undefined>;
|
66
101
|
cancel(reason?: any): Promise<void>;
|
67
102
|
}
|
68
|
-
interface ReadableStreamDefaultReadValueResult<T> {
|
69
|
-
done: false;
|
70
|
-
value: T;
|
71
|
-
}
|
72
|
-
interface ReadableStreamDefaultReadDoneResult {
|
73
|
-
done: true;
|
74
|
-
value?: undefined;
|
75
|
-
}
|
76
103
|
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
77
|
-
type ReadableStreamDefaultReadResult<T> =
|
78
|
-
| ReadableStreamDefaultReadValueResult<T>
|
79
|
-
| ReadableStreamDefaultReadDoneResult;
|
80
104
|
interface ReadableStreamReadValueResult<T> {
|
81
105
|
done: false;
|
82
106
|
value: T;
|
@@ -146,8 +170,9 @@ declare module "stream/web" {
|
|
146
170
|
interface ReadableStream<R = any> {
|
147
171
|
readonly locked: boolean;
|
148
172
|
cancel(reason?: any): Promise<void>;
|
149
|
-
getReader(): ReadableStreamDefaultReader<R>;
|
150
173
|
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
174
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
175
|
+
getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
|
151
176
|
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
152
177
|
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
153
178
|
tee(): [ReadableStream<R>, ReadableStream<R>];
|
@@ -160,20 +185,48 @@ declare module "stream/web" {
|
|
160
185
|
new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
|
161
186
|
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
162
187
|
};
|
188
|
+
type ReadableStreamReaderMode = "byob";
|
189
|
+
interface ReadableStreamGetReaderOptions {
|
190
|
+
/**
|
191
|
+
* Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
|
192
|
+
*
|
193
|
+
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
|
194
|
+
*/
|
195
|
+
mode?: ReadableStreamReaderMode;
|
196
|
+
}
|
197
|
+
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
|
163
198
|
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
164
|
-
read(): Promise<
|
199
|
+
read(): Promise<ReadableStreamReadResult<R>>;
|
165
200
|
releaseLock(): void;
|
166
201
|
}
|
202
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
|
167
203
|
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
|
204
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
|
168
205
|
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
206
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
|
169
207
|
releaseLock(): void;
|
170
208
|
}
|
171
209
|
const ReadableStreamDefaultReader: {
|
172
210
|
prototype: ReadableStreamDefaultReader;
|
173
211
|
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
174
212
|
};
|
175
|
-
const ReadableStreamBYOBReader:
|
176
|
-
|
213
|
+
const ReadableStreamBYOBReader: {
|
214
|
+
prototype: ReadableStreamBYOBReader;
|
215
|
+
new(stream: ReadableStream): ReadableStreamBYOBReader;
|
216
|
+
};
|
217
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
|
218
|
+
interface ReadableStreamBYOBRequest {
|
219
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
|
220
|
+
readonly view: ArrayBufferView | null;
|
221
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
|
222
|
+
respond(bytesWritten: number): void;
|
223
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
|
224
|
+
respondWithNewView(view: ArrayBufferView): void;
|
225
|
+
}
|
226
|
+
const ReadableStreamBYOBRequest: {
|
227
|
+
prototype: ReadableStreamBYOBRequest;
|
228
|
+
new(): ReadableStreamBYOBRequest;
|
229
|
+
};
|
177
230
|
interface ReadableByteStreamController {
|
178
231
|
readonly byobRequest: undefined;
|
179
232
|
readonly desiredSize: number | null;
|
@@ -345,22 +398,208 @@ declare module "stream/web" {
|
|
345
398
|
prototype: TextDecoderStream;
|
346
399
|
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
|
347
400
|
};
|
348
|
-
interface CompressionStream
|
349
|
-
readonly readable: ReadableStream
|
350
|
-
readonly writable: WritableStream
|
401
|
+
interface CompressionStream {
|
402
|
+
readonly readable: ReadableStream;
|
403
|
+
readonly writable: WritableStream;
|
351
404
|
}
|
352
405
|
const CompressionStream: {
|
353
406
|
prototype: CompressionStream;
|
354
|
-
new
|
407
|
+
new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
|
355
408
|
};
|
356
|
-
interface DecompressionStream
|
357
|
-
readonly
|
358
|
-
readonly
|
409
|
+
interface DecompressionStream {
|
410
|
+
readonly writable: WritableStream;
|
411
|
+
readonly readable: ReadableStream;
|
359
412
|
}
|
360
413
|
const DecompressionStream: {
|
361
414
|
prototype: DecompressionStream;
|
362
|
-
new
|
415
|
+
new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
|
363
416
|
};
|
417
|
+
|
418
|
+
global {
|
419
|
+
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
|
420
|
+
/**
|
421
|
+
* `ByteLengthQueuingStrategy` class is a global reference for `require('stream/web').ByteLengthQueuingStrategy`.
|
422
|
+
* https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy
|
423
|
+
* @since v18.0.0
|
424
|
+
*/
|
425
|
+
var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T }
|
426
|
+
? T
|
427
|
+
: typeof import("stream/web").ByteLengthQueuingStrategy;
|
428
|
+
|
429
|
+
interface CompressionStream extends _CompressionStream {}
|
430
|
+
/**
|
431
|
+
* `CompressionStream` class is a global reference for `require('stream/web').CompressionStream`.
|
432
|
+
* https://nodejs.org/api/globals.html#class-compressionstream
|
433
|
+
* @since v18.0.0
|
434
|
+
*/
|
435
|
+
var CompressionStream: typeof globalThis extends {
|
436
|
+
onmessage: any;
|
437
|
+
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
438
|
+
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
439
|
+
ReportingObserver: any;
|
440
|
+
CompressionStream: infer T;
|
441
|
+
} ? T
|
442
|
+
// TS 4.8, 4.9, 5.0
|
443
|
+
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
444
|
+
prototype: T;
|
445
|
+
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
446
|
+
}
|
447
|
+
: typeof import("stream/web").CompressionStream;
|
448
|
+
|
449
|
+
interface CountQueuingStrategy extends _CountQueuingStrategy {}
|
450
|
+
/**
|
451
|
+
* `CountQueuingStrategy` class is a global reference for `require('stream/web').CountQueuingStrategy`.
|
452
|
+
* https://nodejs.org/api/globals.html#class-countqueuingstrategy
|
453
|
+
* @since v18.0.0
|
454
|
+
*/
|
455
|
+
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
|
456
|
+
: typeof import("stream/web").CountQueuingStrategy;
|
457
|
+
|
458
|
+
interface DecompressionStream extends _DecompressionStream {}
|
459
|
+
/**
|
460
|
+
* `DecompressionStream` class is a global reference for `require('stream/web').DecompressionStream`.
|
461
|
+
* https://nodejs.org/api/globals.html#class-decompressionstream
|
462
|
+
* @since v18.0.0
|
463
|
+
*/
|
464
|
+
var DecompressionStream: typeof globalThis extends {
|
465
|
+
onmessage: any;
|
466
|
+
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
467
|
+
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
468
|
+
ReportingObserver: any;
|
469
|
+
DecompressionStream: infer T extends object;
|
470
|
+
} ? T
|
471
|
+
// TS 4.8, 4.9, 5.0
|
472
|
+
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
473
|
+
prototype: T;
|
474
|
+
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
475
|
+
}
|
476
|
+
: typeof import("stream/web").DecompressionStream;
|
477
|
+
|
478
|
+
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|
479
|
+
/**
|
480
|
+
* `ReadableByteStreamController` class is a global reference for `require('stream/web').ReadableByteStreamController`.
|
481
|
+
* https://nodejs.org/api/globals.html#class-readablebytestreamcontroller
|
482
|
+
* @since v18.0.0
|
483
|
+
*/
|
484
|
+
var ReadableByteStreamController: typeof globalThis extends
|
485
|
+
{ onmessage: any; ReadableByteStreamController: infer T } ? T
|
486
|
+
: typeof import("stream/web").ReadableByteStreamController;
|
487
|
+
|
488
|
+
interface ReadableStream<R = any> extends _ReadableStream<R> {}
|
489
|
+
/**
|
490
|
+
* `ReadableStream` class is a global reference for `require('stream/web').ReadableStream`.
|
491
|
+
* https://nodejs.org/api/globals.html#class-readablestream
|
492
|
+
* @since v18.0.0
|
493
|
+
*/
|
494
|
+
var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T
|
495
|
+
: typeof import("stream/web").ReadableStream;
|
496
|
+
|
497
|
+
interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
|
498
|
+
/**
|
499
|
+
* `ReadableStreamBYOBReader` class is a global reference for `require('stream/web').ReadableStreamBYOBReader`.
|
500
|
+
* https://nodejs.org/api/globals.html#class-readablestreambyobreader
|
501
|
+
* @since v18.0.0
|
502
|
+
*/
|
503
|
+
var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T }
|
504
|
+
? T
|
505
|
+
: typeof import("stream/web").ReadableStreamBYOBReader;
|
506
|
+
|
507
|
+
interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
|
508
|
+
/**
|
509
|
+
* `ReadableStreamBYOBRequest` class is a global reference for `require('stream/web').ReadableStreamBYOBRequest`.
|
510
|
+
* https://nodejs.org/api/globals.html#class-readablestreambyobrequest
|
511
|
+
* @since v18.0.0
|
512
|
+
*/
|
513
|
+
var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T }
|
514
|
+
? T
|
515
|
+
: typeof import("stream/web").ReadableStreamBYOBRequest;
|
516
|
+
|
517
|
+
interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
|
518
|
+
/**
|
519
|
+
* `ReadableStreamDefaultController` class is a global reference for `require('stream/web').ReadableStreamDefaultController`.
|
520
|
+
* https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller
|
521
|
+
* @since v18.0.0
|
522
|
+
*/
|
523
|
+
var ReadableStreamDefaultController: typeof globalThis extends
|
524
|
+
{ onmessage: any; ReadableStreamDefaultController: infer T } ? T
|
525
|
+
: typeof import("stream/web").ReadableStreamDefaultController;
|
526
|
+
|
527
|
+
interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
|
528
|
+
/**
|
529
|
+
* `ReadableStreamDefaultReader` class is a global reference for `require('stream/web').ReadableStreamDefaultReader`.
|
530
|
+
* https://nodejs.org/api/globals.html#class-readablestreamdefaultreader
|
531
|
+
* @since v18.0.0
|
532
|
+
*/
|
533
|
+
var ReadableStreamDefaultReader: typeof globalThis extends
|
534
|
+
{ onmessage: any; ReadableStreamDefaultReader: infer T } ? T
|
535
|
+
: typeof import("stream/web").ReadableStreamDefaultReader;
|
536
|
+
|
537
|
+
interface TextDecoderStream extends _TextDecoderStream {}
|
538
|
+
/**
|
539
|
+
* `TextDecoderStream` class is a global reference for `require('stream/web').TextDecoderStream`.
|
540
|
+
* https://nodejs.org/api/globals.html#class-textdecoderstream
|
541
|
+
* @since v18.0.0
|
542
|
+
*/
|
543
|
+
var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T
|
544
|
+
: typeof import("stream/web").TextDecoderStream;
|
545
|
+
|
546
|
+
interface TextEncoderStream extends _TextEncoderStream {}
|
547
|
+
/**
|
548
|
+
* `TextEncoderStream` class is a global reference for `require('stream/web').TextEncoderStream`.
|
549
|
+
* https://nodejs.org/api/globals.html#class-textencoderstream
|
550
|
+
* @since v18.0.0
|
551
|
+
*/
|
552
|
+
var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T
|
553
|
+
: typeof import("stream/web").TextEncoderStream;
|
554
|
+
|
555
|
+
interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
|
556
|
+
/**
|
557
|
+
* `TransformStream` class is a global reference for `require('stream/web').TransformStream`.
|
558
|
+
* https://nodejs.org/api/globals.html#class-transformstream
|
559
|
+
* @since v18.0.0
|
560
|
+
*/
|
561
|
+
var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T
|
562
|
+
: typeof import("stream/web").TransformStream;
|
563
|
+
|
564
|
+
interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
|
565
|
+
/**
|
566
|
+
* `TransformStreamDefaultController` class is a global reference for `require('stream/web').TransformStreamDefaultController`.
|
567
|
+
* https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller
|
568
|
+
* @since v18.0.0
|
569
|
+
*/
|
570
|
+
var TransformStreamDefaultController: typeof globalThis extends
|
571
|
+
{ onmessage: any; TransformStreamDefaultController: infer T } ? T
|
572
|
+
: typeof import("stream/web").TransformStreamDefaultController;
|
573
|
+
|
574
|
+
interface WritableStream<W = any> extends _WritableStream<W> {}
|
575
|
+
/**
|
576
|
+
* `WritableStream` class is a global reference for `require('stream/web').WritableStream`.
|
577
|
+
* https://nodejs.org/api/globals.html#class-writablestream
|
578
|
+
* @since v18.0.0
|
579
|
+
*/
|
580
|
+
var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T
|
581
|
+
: typeof import("stream/web").WritableStream;
|
582
|
+
|
583
|
+
interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
|
584
|
+
/**
|
585
|
+
* `WritableStreamDefaultController` class is a global reference for `require('stream/web').WritableStreamDefaultController`.
|
586
|
+
* https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller
|
587
|
+
* @since v18.0.0
|
588
|
+
*/
|
589
|
+
var WritableStreamDefaultController: typeof globalThis extends
|
590
|
+
{ onmessage: any; WritableStreamDefaultController: infer T } ? T
|
591
|
+
: typeof import("stream/web").WritableStreamDefaultController;
|
592
|
+
|
593
|
+
interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
|
594
|
+
/**
|
595
|
+
* `WritableStreamDefaultWriter` class is a global reference for `require('stream/web').WritableStreamDefaultWriter`.
|
596
|
+
* https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter
|
597
|
+
* @since v18.0.0
|
598
|
+
*/
|
599
|
+
var WritableStreamDefaultWriter: typeof globalThis extends
|
600
|
+
{ onmessage: any; WritableStreamDefaultWriter: infer T } ? T
|
601
|
+
: typeof import("stream/web").WritableStreamDefaultWriter;
|
602
|
+
}
|
364
603
|
}
|
365
604
|
declare module "node:stream/web" {
|
366
605
|
export * from "stream/web";
|
node/test.d.ts
CHANGED
@@ -484,32 +484,36 @@ declare module "node:test" {
|
|
484
484
|
readonly assert: TestContextAssert;
|
485
485
|
/**
|
486
486
|
* This function is used to create a hook running before subtest of the current test.
|
487
|
-
* @param fn The hook function.
|
487
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
488
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
488
489
|
* @param options Configuration options for the hook.
|
489
|
-
* @since v20.1.0
|
490
|
+
* @since v20.1.0, v18.17.0
|
490
491
|
*/
|
491
|
-
before:
|
492
|
+
before(fn?: TestContextHookFn, options?: HookOptions): void;
|
492
493
|
/**
|
493
494
|
* This function is used to create a hook running before each subtest of the current test.
|
494
|
-
* @param fn The hook function.
|
495
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
496
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
495
497
|
* @param options Configuration options for the hook.
|
496
498
|
* @since v18.8.0
|
497
499
|
*/
|
498
|
-
beforeEach:
|
500
|
+
beforeEach(fn?: TestContextHookFn, options?: HookOptions): void;
|
499
501
|
/**
|
500
502
|
* This function is used to create a hook that runs after the current test finishes.
|
501
|
-
* @param fn The hook function.
|
503
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
504
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
502
505
|
* @param options Configuration options for the hook.
|
503
506
|
* @since v18.13.0
|
504
507
|
*/
|
505
|
-
after:
|
508
|
+
after(fn?: TestContextHookFn, options?: HookOptions): void;
|
506
509
|
/**
|
507
510
|
* This function is used to create a hook running after each subtest of the current test.
|
508
|
-
* @param fn The hook function.
|
511
|
+
* @param fn The hook function. The first argument to this function is a `TestContext` object.
|
512
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
509
513
|
* @param options Configuration options for the hook.
|
510
514
|
* @since v18.8.0
|
511
515
|
*/
|
512
|
-
afterEach:
|
516
|
+
afterEach(fn?: TestContextHookFn, options?: HookOptions): void;
|
513
517
|
/**
|
514
518
|
* This function is used to write diagnostics to the output. Any diagnostic
|
515
519
|
* information is included at the end of the test's results. This function does
|
@@ -880,10 +884,15 @@ declare module "node:test" {
|
|
880
884
|
*/
|
881
885
|
function afterEach(fn?: HookFn, options?: HookOptions): void;
|
882
886
|
/**
|
883
|
-
* The hook function.
|
884
|
-
* second argument.
|
887
|
+
* The hook function. The first argument is the context in which the hook is called.
|
888
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
885
889
|
*/
|
886
|
-
type HookFn = (
|
890
|
+
type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any;
|
891
|
+
/**
|
892
|
+
* The hook function. The first argument is a `TestContext` object.
|
893
|
+
* If the hook uses callbacks, the callback function is passed as the second argument.
|
894
|
+
*/
|
895
|
+
type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any;
|
887
896
|
/**
|
888
897
|
* Configuration options for hooks.
|
889
898
|
* @since v18.8.0
|