@types/node 18.19.47 → 18.19.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node v18.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 28 Aug 2024 00:27:14 GMT
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 v18.19/buffer.d.ts CHANGED
@@ -1,3 +1,7 @@
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
+
1
5
  /**
2
6
  * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
3
7
  * Node.js APIs support `Buffer`s.
@@ -212,10 +216,7 @@ declare module "buffer" {
212
216
  }
213
217
  export import atob = globalThis.atob;
214
218
  export import btoa = globalThis.btoa;
215
- import { Blob as NodeBlob } from "buffer";
216
- // This conditional type will be the existing global Blob in a browser, or
217
- // the copy below in a Node environment.
218
- type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
219
+
219
220
  global {
220
221
  namespace NodeJS {
221
222
  export { BufferEncoding };
@@ -2254,17 +2255,14 @@ declare module "buffer" {
2254
2255
  * @param data An ASCII (Latin1) string.
2255
2256
  */
2256
2257
  function btoa(data: string): string;
2257
- interface Blob extends __Blob {}
2258
+ interface Blob extends _Blob {}
2258
2259
  /**
2259
2260
  * `Blob` class is a global reference for `require('node:buffer').Blob`
2260
2261
  * https://nodejs.org/api/buffer.html#class-blob
2261
2262
  * @since v18.0.0
2262
2263
  */
2263
- var Blob: typeof globalThis extends {
2264
- onmessage: any;
2265
- Blob: infer T;
2266
- } ? T
2267
- : typeof NodeBlob;
2264
+ var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
2265
+ : typeof import("buffer").Blob;
2268
2266
  }
2269
2267
  }
2270
2268
  declare module "node:buffer" {
@@ -7,12 +7,83 @@ type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undi
7
7
  type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
8
8
  type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
9
9
  type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
10
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
10
11
  type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
11
12
  : import("undici-types").RequestInit;
12
13
  type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
13
14
  : import("undici-types").ResponseInit;
14
15
  // #endregion Fetch and friends
15
16
 
17
+ // #region DOMException
18
+ type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
19
+ interface NodeDOMException extends Error {
20
+ /**
21
+ * @deprecated
22
+ *
23
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
24
+ */
25
+ readonly code: number;
26
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
27
+ readonly message: string;
28
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
29
+ readonly name: string;
30
+ readonly INDEX_SIZE_ERR: 1;
31
+ readonly DOMSTRING_SIZE_ERR: 2;
32
+ readonly HIERARCHY_REQUEST_ERR: 3;
33
+ readonly WRONG_DOCUMENT_ERR: 4;
34
+ readonly INVALID_CHARACTER_ERR: 5;
35
+ readonly NO_DATA_ALLOWED_ERR: 6;
36
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
37
+ readonly NOT_FOUND_ERR: 8;
38
+ readonly NOT_SUPPORTED_ERR: 9;
39
+ readonly INUSE_ATTRIBUTE_ERR: 10;
40
+ readonly INVALID_STATE_ERR: 11;
41
+ readonly SYNTAX_ERR: 12;
42
+ readonly INVALID_MODIFICATION_ERR: 13;
43
+ readonly NAMESPACE_ERR: 14;
44
+ readonly INVALID_ACCESS_ERR: 15;
45
+ readonly VALIDATION_ERR: 16;
46
+ readonly TYPE_MISMATCH_ERR: 17;
47
+ readonly SECURITY_ERR: 18;
48
+ readonly NETWORK_ERR: 19;
49
+ readonly ABORT_ERR: 20;
50
+ readonly URL_MISMATCH_ERR: 21;
51
+ readonly QUOTA_EXCEEDED_ERR: 22;
52
+ readonly TIMEOUT_ERR: 23;
53
+ readonly INVALID_NODE_TYPE_ERR: 24;
54
+ readonly DATA_CLONE_ERR: 25;
55
+ }
56
+ interface NodeDOMExceptionConstructor {
57
+ prototype: DOMException;
58
+ new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
59
+ readonly INDEX_SIZE_ERR: 1;
60
+ readonly DOMSTRING_SIZE_ERR: 2;
61
+ readonly HIERARCHY_REQUEST_ERR: 3;
62
+ readonly WRONG_DOCUMENT_ERR: 4;
63
+ readonly INVALID_CHARACTER_ERR: 5;
64
+ readonly NO_DATA_ALLOWED_ERR: 6;
65
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
66
+ readonly NOT_FOUND_ERR: 8;
67
+ readonly NOT_SUPPORTED_ERR: 9;
68
+ readonly INUSE_ATTRIBUTE_ERR: 10;
69
+ readonly INVALID_STATE_ERR: 11;
70
+ readonly SYNTAX_ERR: 12;
71
+ readonly INVALID_MODIFICATION_ERR: 13;
72
+ readonly NAMESPACE_ERR: 14;
73
+ readonly INVALID_ACCESS_ERR: 15;
74
+ readonly VALIDATION_ERR: 16;
75
+ readonly TYPE_MISMATCH_ERR: 17;
76
+ readonly SECURITY_ERR: 18;
77
+ readonly NETWORK_ERR: 19;
78
+ readonly ABORT_ERR: 20;
79
+ readonly URL_MISMATCH_ERR: 21;
80
+ readonly QUOTA_EXCEEDED_ERR: 22;
81
+ readonly TIMEOUT_ERR: 23;
82
+ readonly INVALID_NODE_TYPE_ERR: 24;
83
+ readonly DATA_CLONE_ERR: 25;
84
+ }
85
+ // #endregion DOMException
86
+
16
87
  declare global {
17
88
  // Declare "static" methods in Error
18
89
  interface ErrorConstructor {
@@ -156,6 +227,24 @@ declare global {
156
227
  transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
157
228
  ): T;
158
229
 
230
+ // #region DOMException
231
+ /**
232
+ * @since v17.0.0
233
+ * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
234
+ *
235
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
236
+ */
237
+ interface DOMException extends _DOMException {}
238
+
239
+ /**
240
+ * @since v17.0.0
241
+ *
242
+ * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details.
243
+ */
244
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
245
+ : NodeDOMExceptionConstructor;
246
+ // #endregion DOMException
247
+
159
248
  /*----------------------------------------------*
160
249
  * *
161
250
  * GLOBAL INTERFACES *
@@ -375,4 +464,14 @@ declare global {
375
464
  Headers: infer T;
376
465
  } ? T
377
466
  : typeof import("undici-types").Headers;
467
+
468
+ interface MessageEvent extends _MessageEvent {}
469
+ /**
470
+ * @since v15.0.0
471
+ */
472
+ var MessageEvent: typeof globalThis extends {
473
+ onmessage: any;
474
+ MessageEvent: infer T;
475
+ } ? T
476
+ : typeof import("undici-types").MessageEvent;
378
477
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.47",
3
+ "version": "18.19.48",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -217,6 +217,6 @@
217
217
  "dependencies": {
218
218
  "undici-types": "~5.26.4"
219
219
  },
220
- "typesPublisherContentHash": "d1f247a2b67ea5d8676a67452a9d6d88919b6c5938bf06bf1e6f689cf3b02713",
220
+ "typesPublisherContentHash": "5ce9cffaeee72821d1d992438407df2493e219642e4b4d833ac5a9ef3b70161c",
221
221
  "typeScriptVersion": "4.8"
222
222
  }
@@ -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,16 @@ declare module "stream/web" {
65
100
  readonly closed: Promise<undefined>;
66
101
  cancel(reason?: any): Promise<void>;
67
102
  }
68
- interface ReadableStreamDefaultReadValueResult<T> {
103
+ type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
104
+ interface ReadableStreamReadValueResult<T> {
69
105
  done: false;
70
106
  value: T;
71
107
  }
72
- interface ReadableStreamDefaultReadDoneResult {
108
+ interface ReadableStreamReadDoneResult<T> {
73
109
  done: true;
74
- value?: undefined;
110
+ value?: T;
75
111
  }
76
- type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
77
- type ReadableStreamDefaultReadResult<T> =
78
- | ReadableStreamDefaultReadValueResult<T>
79
- | ReadableStreamDefaultReadDoneResult;
112
+ type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
80
113
  interface ReadableByteStreamControllerCallback {
81
114
  (controller: ReadableByteStreamController): void | PromiseLike<void>;
82
115
  }
@@ -137,7 +170,9 @@ declare module "stream/web" {
137
170
  interface ReadableStream<R = any> {
138
171
  readonly locked: boolean;
139
172
  cancel(reason?: any): Promise<void>;
173
+ getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
140
174
  getReader(): ReadableStreamDefaultReader<R>;
175
+ getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
141
176
  pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
142
177
  pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
143
178
  tee(): [ReadableStream<R>, ReadableStream<R>];
@@ -149,16 +184,48 @@ declare module "stream/web" {
149
184
  new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
150
185
  new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
151
186
  };
187
+ type ReadableStreamReaderMode = "byob";
188
+ interface ReadableStreamGetReaderOptions {
189
+ /**
190
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
191
+ *
192
+ * 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.
193
+ */
194
+ mode?: ReadableStreamReaderMode;
195
+ }
196
+ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
152
197
  interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
153
- read(): Promise<ReadableStreamDefaultReadResult<R>>;
198
+ read(): Promise<ReadableStreamReadResult<R>>;
199
+ releaseLock(): void;
200
+ }
201
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
202
+ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
203
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
204
+ read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
205
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
154
206
  releaseLock(): void;
155
207
  }
156
208
  const ReadableStreamDefaultReader: {
157
209
  prototype: ReadableStreamDefaultReader;
158
210
  new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
159
211
  };
160
- const ReadableStreamBYOBReader: any;
161
- const ReadableStreamBYOBRequest: any;
212
+ const ReadableStreamBYOBReader: {
213
+ prototype: ReadableStreamBYOBReader;
214
+ new(stream: ReadableStream): ReadableStreamBYOBReader;
215
+ };
216
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
217
+ interface ReadableStreamBYOBRequest {
218
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
219
+ readonly view: ArrayBufferView | null;
220
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
221
+ respond(bytesWritten: number): void;
222
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
223
+ respondWithNewView(view: ArrayBufferView): void;
224
+ }
225
+ const ReadableStreamBYOBRequest: {
226
+ prototype: ReadableStreamBYOBRequest;
227
+ new(): ReadableStreamBYOBRequest;
228
+ };
162
229
  interface ReadableByteStreamController {
163
230
  readonly byobRequest: undefined;
164
231
  readonly desiredSize: number | null;
@@ -330,22 +397,123 @@ declare module "stream/web" {
330
397
  prototype: TextDecoderStream;
331
398
  new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
332
399
  };
333
- interface CompressionStream<R = any, W = any> {
334
- readonly readable: ReadableStream<R>;
335
- readonly writable: WritableStream<W>;
400
+ interface CompressionStream {
401
+ readonly readable: ReadableStream;
402
+ readonly writable: WritableStream;
336
403
  }
337
404
  const CompressionStream: {
338
405
  prototype: CompressionStream;
339
- new<R = any, W = any>(format: string): CompressionStream<R, W>;
406
+ new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
340
407
  };
341
- interface DecompressionStream<R = any, W = any> {
342
- readonly readable: ReadableStream<R>;
343
- readonly writable: WritableStream<W>;
408
+ interface DecompressionStream {
409
+ readonly writable: WritableStream;
410
+ readonly readable: ReadableStream;
344
411
  }
345
412
  const DecompressionStream: {
346
413
  prototype: DecompressionStream;
347
- new<R = any, W = any>(format: string): DecompressionStream<R, W>;
414
+ new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
348
415
  };
416
+
417
+ global {
418
+ interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
419
+ var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T }
420
+ ? T
421
+ : typeof import("stream/web").ByteLengthQueuingStrategy;
422
+
423
+ interface CompressionStream extends _CompressionStream {}
424
+ var CompressionStream: typeof globalThis extends {
425
+ onmessage: any;
426
+ // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
427
+ // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
428
+ ReportingObserver: any;
429
+ CompressionStream: infer T;
430
+ } ? T
431
+ // TS 4.8, 4.9, 5.0
432
+ : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
433
+ prototype: T;
434
+ new(format: "deflate" | "deflate-raw" | "gzip"): T;
435
+ }
436
+ : typeof import("stream/web").CompressionStream;
437
+
438
+ interface CountQueuingStrategy extends _CountQueuingStrategy {}
439
+ var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
440
+ : typeof import("stream/web").CountQueuingStrategy;
441
+
442
+ interface DecompressionStream extends _DecompressionStream {}
443
+ var DecompressionStream: typeof globalThis extends {
444
+ onmessage: any;
445
+ // CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
446
+ // If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
447
+ ReportingObserver: any;
448
+ DecompressionStream: infer T;
449
+ } ? T
450
+ // TS 4.8, 4.9, 5.0
451
+ : typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
452
+ prototype: T;
453
+ new(format: "deflate" | "deflate-raw" | "gzip"): T;
454
+ }
455
+ : typeof import("stream/web").DecompressionStream;
456
+
457
+ interface ReadableByteStreamController extends _ReadableByteStreamController {}
458
+ var ReadableByteStreamController: typeof globalThis extends
459
+ { onmessage: any; ReadableByteStreamController: infer T } ? T
460
+ : typeof import("stream/web").ReadableByteStreamController;
461
+
462
+ interface ReadableStream<R = any> extends _ReadableStream<R> {}
463
+ var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T
464
+ : typeof import("stream/web").ReadableStream;
465
+
466
+ interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
467
+ var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T }
468
+ ? T
469
+ : typeof import("stream/web").ReadableStreamBYOBReader;
470
+
471
+ interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
472
+ var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T }
473
+ ? T
474
+ : typeof import("stream/web").ReadableStreamBYOBRequest;
475
+
476
+ interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
477
+ var ReadableStreamDefaultController: typeof globalThis extends
478
+ { onmessage: any; ReadableStreamDefaultController: infer T } ? T
479
+ : typeof import("stream/web").ReadableStreamDefaultController;
480
+
481
+ interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
482
+ var ReadableStreamDefaultReader: typeof globalThis extends
483
+ { onmessage: any; ReadableStreamDefaultReader: infer T } ? T
484
+ : typeof import("stream/web").ReadableStreamDefaultReader;
485
+
486
+ interface TextDecoderStream extends _TextDecoderStream {}
487
+ var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T
488
+ : typeof import("stream/web").TextDecoderStream;
489
+
490
+ interface TextEncoderStream extends _TextEncoderStream {}
491
+ var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T
492
+ : typeof import("stream/web").TextEncoderStream;
493
+
494
+ interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
495
+ var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T
496
+ : typeof import("stream/web").TransformStream;
497
+
498
+ interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
499
+ var TransformStreamDefaultController: typeof globalThis extends
500
+ { onmessage: any; TransformStreamDefaultController: infer T } ? T
501
+ : typeof import("stream/web").TransformStreamDefaultController;
502
+
503
+ interface WritableStream<W = any> extends _WritableStream<W> {}
504
+ var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T
505
+ : typeof import("stream/web").WritableStream;
506
+
507
+ interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
508
+ var WritableStreamDefaultController: typeof globalThis extends
509
+ { onmessage: any; WritableStreamDefaultController: infer T } ? T
510
+ : typeof import("stream/web").WritableStreamDefaultController;
511
+
512
+ interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
513
+ var WritableStreamDefaultWriter: typeof globalThis extends
514
+ { onmessage: any; WritableStreamDefaultWriter: infer T } ? T
515
+ : typeof import("stream/web").WritableStreamDefaultWriter;
516
+ }
349
517
  }
350
518
  declare module "node:stream/web" {
351
519
  export * from "stream/web";
node v18.19/test.d.ts CHANGED
@@ -315,39 +315,39 @@ declare module "node:test" {
315
315
  export interface TestContext {
316
316
  /**
317
317
  * This function is used to create a hook running before subtest of the current test.
318
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
319
- * the second argument. Default: A no-op function.
318
+ * @param fn The hook function. The first argument to this function is a `TestContext` object.
319
+ * If the hook uses callbacks, the callback function is passed as the second argument.
320
320
  * @param options Configuration options for the hook.
321
321
  * @since v18.17.0
322
322
  */
323
- before: typeof before;
323
+ before(fn?: TestContextHookFn, options?: HookOptions): void;
324
324
 
325
325
  /**
326
326
  * This function is used to create a hook running before each subtest of the current test.
327
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
328
- * the second argument. Default: A no-op function.
327
+ * @param fn The hook function. The first argument to this function is a `TestContext` object.
328
+ * If the hook uses callbacks, the callback function is passed as the second argument.
329
329
  * @param options Configuration options for the hook.
330
330
  * @since v18.8.0
331
331
  */
332
- beforeEach: typeof beforeEach;
332
+ beforeEach(fn?: TestContextHookFn, options?: HookOptions): void;
333
333
 
334
334
  /**
335
335
  * This function is used to create a hook that runs after the current test finishes.
336
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
337
- * the second argument. Default: A no-op function.
336
+ * @param fn The hook function. The first argument to this function is a `TestContext` object.
337
+ * If the hook uses callbacks, the callback function is passed as the second argument.
338
338
  * @param options Configuration options for the hook.
339
339
  * @since v18.13.0
340
340
  */
341
- after: typeof after;
341
+ after(fn?: TestContextHookFn, options?: HookOptions): void;
342
342
 
343
343
  /**
344
344
  * This function is used to create a hook running after each subtest of the current test.
345
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
346
- * the second argument. Default: A no-op function.
345
+ * @param fn The hook function. The first argument to this function is a `TestContext` object.
346
+ * If the hook uses callbacks, the callback function is passed as the second argument.
347
347
  * @param options Configuration options for the hook.
348
348
  * @since v18.8.0
349
349
  */
350
- afterEach: typeof afterEach;
350
+ afterEach(fn?: TestContextHookFn, options?: HookOptions): void;
351
351
 
352
352
  /**
353
353
  * This function is used to write diagnostics to the output. Any diagnostic information is
@@ -517,10 +517,16 @@ declare module "node:test" {
517
517
  function afterEach(fn?: HookFn, options?: HookOptions): void;
518
518
 
519
519
  /**
520
- * The hook function. If the hook uses callbacks, the callback function is passed as the
521
- * second argument.
520
+ * The hook function. The first argument is the context in which the hook is called.
521
+ * If the hook uses callbacks, the callback function is passed as the second argument.
522
522
  */
523
- type HookFn = (s: SuiteContext, done: (result?: any) => void) => any;
523
+ type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any;
524
+
525
+ /**
526
+ * The hook function. The first argument is a `TestContext` object.
527
+ * If the hook uses callbacks, the callback function is passed as the second argument.
528
+ */
529
+ type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any;
524
530
 
525
531
  /**
526
532
  * Configuration options for hooks.