@types/node 18.8.4 → 18.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (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: Mon, 10 Oct 2022 21:33:31 GMT
11
+ * Last updated: Fri, 14 Oct 2022 20:32:59 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/buffer.d.ts CHANGED
@@ -166,7 +166,11 @@ declare module 'buffer' {
166
166
  export import atob = globalThis.atob;
167
167
  export import btoa = globalThis.btoa;
168
168
 
169
- import { Blob as _Blob } from 'buffer';
169
+ import { Blob as NodeBlob } from 'buffer';
170
+ // This conditional type will be the existing global Blob in a browser, or
171
+ // the copy below in a Node environment.
172
+ type __Blob = typeof globalThis extends { onmessage: any, Blob: infer T }
173
+ ? T : NodeBlob;
170
174
  global {
171
175
  // Buffer class
172
176
  type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
@@ -2235,6 +2239,7 @@ declare module 'buffer' {
2235
2239
  */
2236
2240
  function btoa(data: string): string;
2237
2241
 
2242
+ interface Blob extends __Blob {}
2238
2243
  /**
2239
2244
  * `Blob` class is a global reference for `require('node:buffer').Blob`
2240
2245
  * https://nodejs.org/api/buffer.html#class-blob
@@ -2245,7 +2250,7 @@ declare module 'buffer' {
2245
2250
  Blob: infer T;
2246
2251
  }
2247
2252
  ? T
2248
- : typeof _Blob;
2253
+ : typeof NodeBlob;
2249
2254
  }
2250
2255
  }
2251
2256
  declare module 'node:buffer' {
node/crypto.d.ts CHANGED
@@ -3723,7 +3723,9 @@ declare module 'crypto' {
3723
3723
  /**
3724
3724
  * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
3725
3725
  * `subtle.deriveBits()` attempts to generate `length` bits.
3726
- * The Node.js implementation requires that `length` is a multiple of `8`.
3726
+ * The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
3727
+ * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
3728
+ * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
3727
3729
  * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
3728
3730
  *
3729
3731
  * The algorithms currently supported include:
@@ -3735,7 +3737,8 @@ declare module 'crypto' {
3735
3737
  * - `'PBKDF2'`
3736
3738
  * @since v15.0.0
3737
3739
  */
3738
- deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
3740
+ deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
3741
+ deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
3739
3742
  /**
3740
3743
  * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
3741
3744
  * `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
node/fs/promises.d.ts CHANGED
@@ -37,6 +37,7 @@ declare module 'fs/promises' {
37
37
  WriteStream,
38
38
  WriteVResult,
39
39
  } from 'node:fs';
40
+ import { Interface as ReadlineInterface } from 'node:readline';
40
41
 
41
42
  interface FileChangeInfo<T extends string | Buffer> {
42
43
  eventType: WatchEventType;
@@ -284,6 +285,23 @@ declare module 'fs/promises' {
284
285
  | BufferEncoding
285
286
  | null
286
287
  ): Promise<string | Buffer>;
288
+ /**
289
+ * Convenience method to create a `readline` interface and stream over the file. For example:
290
+ *
291
+ * ```js
292
+ * import { open } from 'node:fs/promises';
293
+ *
294
+ * const file = await open('./some/file/to/read');
295
+ *
296
+ * for await (const line of file.readLines()) {
297
+ * console.log(line);
298
+ * }
299
+ * ```
300
+ *
301
+ * @since v18.11.0
302
+ * @param options See `filehandle.createReadStream()` for the options.
303
+ */
304
+ readLines(options?: CreateReadStreamOptions): ReadlineInterface;
287
305
  /**
288
306
  * @since v10.0.0
289
307
  * @return Fulfills with an {fs.Stats} for the file.
node/http.d.ts CHANGED
@@ -570,11 +570,46 @@ declare module 'http' {
570
570
  assignSocket(socket: Socket): void;
571
571
  detachSocket(socket: Socket): void;
572
572
  /**
573
- * Sends a HTTP/1.1 100 Continue message to the client, indicating that
573
+ * Sends an HTTP/1.1 100 Continue message to the client, indicating that
574
574
  * the request body should be sent. See the `'checkContinue'` event on`Server`.
575
575
  * @since v0.3.0
576
576
  */
577
577
  writeContinue(callback?: () => void): void;
578
+ /**
579
+ * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
580
+ * indicating that the user agent can preload/preconnect the linked resources.
581
+ * The `hints` is an object containing the values of headers to be sent with
582
+ * early hints message. The optional `callback` argument will be called when
583
+ * the response message has been written.
584
+ *
585
+ * Example:
586
+ *
587
+ * ```js
588
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
589
+ * response.writeEarlyHints({
590
+ * 'link': earlyHintsLink,
591
+ * });
592
+ *
593
+ * const earlyHintsLinks = [
594
+ * '</styles.css>; rel=preload; as=style',
595
+ * '</scripts.js>; rel=preload; as=script',
596
+ * ];
597
+ * response.writeEarlyHints({
598
+ * 'link': earlyHintsLinks,
599
+ * 'x-trace-id': 'id for diagnostics'
600
+ * });
601
+ *
602
+ * const earlyHintsCallback = () => console.log('early hints message sent');
603
+ * response.writeEarlyHints({
604
+ * 'link': earlyHintsLinks
605
+ * }, earlyHintsCallback);
606
+ * ```
607
+ *
608
+ * @since v18.11.0
609
+ * @param hints An object containing the values of headers
610
+ * @param callback Will be called when the response message has been written
611
+ */
612
+ writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
578
613
  /**
579
614
  * Sends a response header to the request. The status code is a 3-digit HTTP
580
615
  * status code, like `404`. The last argument, `headers`, are the response headers.
@@ -639,7 +674,7 @@ declare module 'http' {
639
674
  ): this;
640
675
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
641
676
  /**
642
- * Sends a HTTP/1.1 102 Processing message to the client, indicating that
677
+ * Sends an HTTP/1.1 102 Processing message to the client, indicating that
643
678
  * the request body should be sent.
644
679
  * @since v10.0.0
645
680
  */
node/http2.d.ts CHANGED
@@ -1670,6 +1670,34 @@ declare module 'http2' {
1670
1670
  * @since v8.4.0
1671
1671
  */
1672
1672
  writeContinue(): void;
1673
+ /**
1674
+ * Sends a status `103 Early Hints` to the client with a Link header,
1675
+ * indicating that the user agent can preload/preconnect the linked resources.
1676
+ * The `hints` is an object containing the values of headers to be sent with
1677
+ * early hints message.
1678
+ *
1679
+ * Example:
1680
+ *
1681
+ * ```js
1682
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
1683
+ * response.writeEarlyHints({
1684
+ * 'link': earlyHintsLink,
1685
+ * });
1686
+ *
1687
+ * const earlyHintsLinks = [
1688
+ * '</styles.css>; rel=preload; as=style',
1689
+ * '</scripts.js>; rel=preload; as=script',
1690
+ * ];
1691
+ * response.writeEarlyHints({
1692
+ * 'link': earlyHintsLinks,
1693
+ * 'x-trace-id': 'id for diagnostics'
1694
+ * });
1695
+ * ```
1696
+ *
1697
+ * @since v18.11.0
1698
+ * @param hints An object containing the values of headers
1699
+ */
1700
+ writeEarlyHints(hints: Record<string, string | string[]>): void;
1673
1701
  /**
1674
1702
  * Sends a response header to the request. The status code is a 3-digit HTTP
1675
1703
  * status code, like `404`. The last argument, `headers`, are the response headers.
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 18.8
1
+ // Type definitions for non-npm package Node.js 18.11
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.8.4",
3
+ "version": "18.11.0",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "c77acbd7196d2ac8a09c9dbff0f75aabaead5468c1cfd9d9db404e7f6989deac",
230
+ "typesPublisherContentHash": "bec614c152bf72c7a29b996ba58cf8e86e92e1371bf820fac0654a49a16fce5f",
231
231
  "typeScriptVersion": "4.1"
232
232
  }
node/path.d.ts CHANGED
@@ -122,10 +122,10 @@ declare module 'path' {
122
122
  * Often used to extract the file name from a fully qualified path.
123
123
  *
124
124
  * @param path the path to evaluate.
125
- * @param ext optionally, an extension to remove from the result.
125
+ * @param suffix optionally, an extension to remove from the result.
126
126
  * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
127
127
  */
128
- basename(path: string, ext?: string): string;
128
+ basename(path: string, suffix?: string): string;
129
129
  /**
130
130
  * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
131
131
  * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
node/stream.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
  declare module 'stream' {
20
20
  import { EventEmitter, Abortable } from 'node:events';
21
- import { Blob } from "node:buffer";
21
+ import { Blob as NodeBlob } from "node:buffer";
22
22
  import * as streamPromises from 'node:stream/promises';
23
23
  import * as streamConsumers from 'node:stream/consumers';
24
24
  import * as streamWeb from 'node:stream/web';
@@ -893,7 +893,7 @@ declare module 'stream' {
893
893
  *
894
894
  * @since v16.8.0
895
895
  */
896
- static from(src: Stream | Blob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
896
+ static from(src: Stream | NodeBlob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
897
897
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
898
898
  _writev?(
899
899
  chunks: Array<{
node/ts4.8/buffer.d.ts CHANGED
@@ -166,7 +166,12 @@ declare module 'buffer' {
166
166
  export import atob = globalThis.atob;
167
167
  export import btoa = globalThis.btoa;
168
168
 
169
- import { Blob as _Blob } from 'buffer';
169
+ import { Blob as NodeBlob } from 'buffer';
170
+ // This conditional type will be the existing global Blob in a browser, or
171
+ // the copy below in a Node environment.
172
+ type __Blob = typeof globalThis extends { onmessage: any, Blob: infer T }
173
+ ? T : NodeBlob;
174
+
170
175
  global {
171
176
  // Buffer class
172
177
  type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
@@ -2235,6 +2240,7 @@ declare module 'buffer' {
2235
2240
  */
2236
2241
  function btoa(data: string): string;
2237
2242
 
2243
+ interface Blob extends __Blob {}
2238
2244
  /**
2239
2245
  * `Blob` class is a global reference for `require('node:buffer').Blob`
2240
2246
  * https://nodejs.org/api/buffer.html#class-blob
@@ -2245,7 +2251,7 @@ declare module 'buffer' {
2245
2251
  Blob: infer T;
2246
2252
  }
2247
2253
  ? T
2248
- : typeof _Blob;
2254
+ : typeof NodeBlob;
2249
2255
  }
2250
2256
  }
2251
2257
  declare module 'node:buffer' {
node/ts4.8/crypto.d.ts CHANGED
@@ -3723,7 +3723,9 @@ declare module 'crypto' {
3723
3723
  /**
3724
3724
  * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
3725
3725
  * `subtle.deriveBits()` attempts to generate `length` bits.
3726
- * The Node.js implementation requires that `length` is a multiple of `8`.
3726
+ * The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
3727
+ * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
3728
+ * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
3727
3729
  * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
3728
3730
  *
3729
3731
  * The algorithms currently supported include:
@@ -3735,7 +3737,8 @@ declare module 'crypto' {
3735
3737
  * - `'PBKDF2'`
3736
3738
  * @since v15.0.0
3737
3739
  */
3738
- deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
3740
+ deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
3741
+ deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
3739
3742
  /**
3740
3743
  * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
3741
3744
  * `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
@@ -37,6 +37,7 @@ declare module 'fs/promises' {
37
37
  WriteStream,
38
38
  WriteVResult,
39
39
  } from 'node:fs';
40
+ import { Interface as ReadlineInterface } from 'node:readline';
40
41
 
41
42
  interface FileChangeInfo<T extends string | Buffer> {
42
43
  eventType: WatchEventType;
@@ -284,6 +285,23 @@ declare module 'fs/promises' {
284
285
  | BufferEncoding
285
286
  | null
286
287
  ): Promise<string | Buffer>;
288
+ /**
289
+ * Convenience method to create a `readline` interface and stream over the file. For example:
290
+ *
291
+ * ```js
292
+ * import { open } from 'node:fs/promises';
293
+ *
294
+ * const file = await open('./some/file/to/read');
295
+ *
296
+ * for await (const line of file.readLines()) {
297
+ * console.log(line);
298
+ * }
299
+ * ```
300
+ *
301
+ * @since v18.11.0
302
+ * @param options See `filehandle.createReadStream()` for the options.
303
+ */
304
+ readLines(options?: CreateReadStreamOptions): ReadlineInterface;
287
305
  /**
288
306
  * @since v10.0.0
289
307
  * @return Fulfills with an {fs.Stats} for the file.
node/ts4.8/http.d.ts CHANGED
@@ -570,11 +570,46 @@ declare module 'http' {
570
570
  assignSocket(socket: Socket): void;
571
571
  detachSocket(socket: Socket): void;
572
572
  /**
573
- * Sends a HTTP/1.1 100 Continue message to the client, indicating that
573
+ * Sends an HTTP/1.1 100 Continue message to the client, indicating that
574
574
  * the request body should be sent. See the `'checkContinue'` event on`Server`.
575
575
  * @since v0.3.0
576
576
  */
577
577
  writeContinue(callback?: () => void): void;
578
+ /**
579
+ * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
580
+ * indicating that the user agent can preload/preconnect the linked resources.
581
+ * The `hints` is an object containing the values of headers to be sent with
582
+ * early hints message. The optional `callback` argument will be called when
583
+ * the response message has been written.
584
+ *
585
+ * Example:
586
+ *
587
+ * ```js
588
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
589
+ * response.writeEarlyHints({
590
+ * 'link': earlyHintsLink,
591
+ * });
592
+ *
593
+ * const earlyHintsLinks = [
594
+ * '</styles.css>; rel=preload; as=style',
595
+ * '</scripts.js>; rel=preload; as=script',
596
+ * ];
597
+ * response.writeEarlyHints({
598
+ * 'link': earlyHintsLinks,
599
+ * 'x-trace-id': 'id for diagnostics'
600
+ * });
601
+ *
602
+ * const earlyHintsCallback = () => console.log('early hints message sent');
603
+ * response.writeEarlyHints({
604
+ * 'link': earlyHintsLinks
605
+ * }, earlyHintsCallback);
606
+ * ```
607
+ *
608
+ * @since v18.11.0
609
+ * @param hints An object containing the values of headers
610
+ * @param callback Will be called when the response message has been written
611
+ */
612
+ writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
578
613
  /**
579
614
  * Sends a response header to the request. The status code is a 3-digit HTTP
580
615
  * status code, like `404`. The last argument, `headers`, are the response headers.
@@ -639,7 +674,7 @@ declare module 'http' {
639
674
  ): this;
640
675
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
641
676
  /**
642
- * Sends a HTTP/1.1 102 Processing message to the client, indicating that
677
+ * Sends an HTTP/1.1 102 Processing message to the client, indicating that
643
678
  * the request body should be sent.
644
679
  * @since v10.0.0
645
680
  */
node/ts4.8/http2.d.ts CHANGED
@@ -1670,6 +1670,34 @@ declare module 'http2' {
1670
1670
  * @since v8.4.0
1671
1671
  */
1672
1672
  writeContinue(): void;
1673
+ /**
1674
+ * Sends a status `103 Early Hints` to the client with a Link header,
1675
+ * indicating that the user agent can preload/preconnect the linked resources.
1676
+ * The `hints` is an object containing the values of headers to be sent with
1677
+ * early hints message.
1678
+ *
1679
+ * Example:
1680
+ *
1681
+ * ```js
1682
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
1683
+ * response.writeEarlyHints({
1684
+ * 'link': earlyHintsLink,
1685
+ * });
1686
+ *
1687
+ * const earlyHintsLinks = [
1688
+ * '</styles.css>; rel=preload; as=style',
1689
+ * '</scripts.js>; rel=preload; as=script',
1690
+ * ];
1691
+ * response.writeEarlyHints({
1692
+ * 'link': earlyHintsLinks,
1693
+ * 'x-trace-id': 'id for diagnostics'
1694
+ * });
1695
+ * ```
1696
+ *
1697
+ * @since v18.11.0
1698
+ * @param hints An object containing the values of headers
1699
+ */
1700
+ writeEarlyHints(hints: Record<string, string | string[]>): void;
1673
1701
  /**
1674
1702
  * Sends a response header to the request. The status code is a 3-digit HTTP
1675
1703
  * status code, like `404`. The last argument, `headers`, are the response headers.
node/ts4.8/path.d.ts CHANGED
@@ -122,10 +122,10 @@ declare module 'path' {
122
122
  * Often used to extract the file name from a fully qualified path.
123
123
  *
124
124
  * @param path the path to evaluate.
125
- * @param ext optionally, an extension to remove from the result.
125
+ * @param suffix optionally, an extension to remove from the result.
126
126
  * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
127
127
  */
128
- basename(path: string, ext?: string): string;
128
+ basename(path: string, suffix?: string): string;
129
129
  /**
130
130
  * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
131
131
  * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
node/ts4.8/stream.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
  declare module 'stream' {
20
20
  import { EventEmitter, Abortable } from 'node:events';
21
- import { Blob } from "node:buffer";
21
+ import { Blob as NodeBlob } from "node:buffer";
22
22
  import * as streamPromises from 'node:stream/promises';
23
23
  import * as streamConsumers from 'node:stream/consumers';
24
24
  import * as streamWeb from 'node:stream/web';
@@ -893,7 +893,7 @@ declare module 'stream' {
893
893
  *
894
894
  * @since v16.8.0
895
895
  */
896
- static from(src: Stream | Blob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
896
+ static from(src: Stream | NodeBlob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
897
897
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
898
898
  _writev?(
899
899
  chunks: Array<{
node/ts4.8/util.d.ts CHANGED
@@ -162,6 +162,27 @@ declare module 'util' {
162
162
  * @since v16.8.0, v14.18.0
163
163
  */
164
164
  export function toUSVString(string: string): string;
165
+ /**
166
+ * Creates and returns an `AbortController` instance whose `AbortSignal` is marked
167
+ * as transferable and can be used with `structuredClone()` or `postMessage()`.
168
+ * @since v18.11.0
169
+ * @returns A transferable AbortController
170
+ */
171
+ export function transferableAbortController(): AbortController;
172
+ /**
173
+ * Marks the given {AbortSignal} as transferable so that it can be used with
174
+ * `structuredClone()` and `postMessage()`.
175
+ *
176
+ * ```js
177
+ * const signal = transferableAbortSignal(AbortSignal.timeout(100));
178
+ * const channel = new MessageChannel();
179
+ * channel.port2.postMessage(signal, [signal]);
180
+ * ```
181
+ * @since v18.11.0
182
+ * @param signal The AbortSignal
183
+ * @returns The same AbortSignal
184
+ */
185
+ export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
165
186
  /**
166
187
  * The `util.inspect()` method returns a string representation of `object` that is
167
188
  * intended for debugging. The output of `util.inspect` may change at any time
@@ -1155,6 +1176,9 @@ declare module 'util' {
1155
1176
  * times. If `true`, all values will be collected in an array. If
1156
1177
  * `false`, values for the option are last-wins. **Default:** `false`.
1157
1178
  * - `short` A single character alias for the option.
1179
+ * - `default` The default option value when it is not set by args. It
1180
+ * must be of the same type as the `type` property. When `multiple`
1181
+ * is `true`, it must be an array.
1158
1182
  *
1159
1183
  * - `strict`: Whether an error should be thrown when unknown arguments
1160
1184
  * are encountered, or when arguments are passed that do not match the
@@ -1180,6 +1204,10 @@ declare module 'util' {
1180
1204
  type: 'string' | 'boolean';
1181
1205
  short?: string;
1182
1206
  multiple?: boolean;
1207
+ /**
1208
+ * @since v18.11.0
1209
+ */
1210
+ default?: string | boolean | string[] | boolean[];
1183
1211
  }
1184
1212
 
1185
1213
  interface ParseArgsOptionsConfig {
node/util.d.ts CHANGED
@@ -162,6 +162,27 @@ declare module 'util' {
162
162
  * @since v16.8.0, v14.18.0
163
163
  */
164
164
  export function toUSVString(string: string): string;
165
+ /**
166
+ * Creates and returns an `AbortController` instance whose `AbortSignal` is marked
167
+ * as transferable and can be used with `structuredClone()` or `postMessage()`.
168
+ * @since v18.11.0
169
+ * @returns A transferable AbortController
170
+ */
171
+ export function transferableAbortController(): AbortController;
172
+ /**
173
+ * Marks the given {AbortSignal} as transferable so that it can be used with
174
+ * `structuredClone()` and `postMessage()`.
175
+ *
176
+ * ```js
177
+ * const signal = transferableAbortSignal(AbortSignal.timeout(100));
178
+ * const channel = new MessageChannel();
179
+ * channel.port2.postMessage(signal, [signal]);
180
+ * ```
181
+ * @since v18.11.0
182
+ * @param signal The AbortSignal
183
+ * @returns The same AbortSignal
184
+ */
185
+ export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
165
186
  /**
166
187
  * The `util.inspect()` method returns a string representation of `object` that is
167
188
  * intended for debugging. The output of `util.inspect` may change at any time
@@ -1155,6 +1176,9 @@ declare module 'util' {
1155
1176
  * times. If `true`, all values will be collected in an array. If
1156
1177
  * `false`, values for the option are last-wins. **Default:** `false`.
1157
1178
  * - `short` A single character alias for the option.
1179
+ * - `default` The default option value when it is not set by args. It
1180
+ * must be of the same type as the `type` property. When `multiple`
1181
+ * is `true`, it must be an array.
1158
1182
  *
1159
1183
  * - `strict`: Whether an error should be thrown when unknown arguments
1160
1184
  * are encountered, or when arguments are passed that do not match the
@@ -1180,6 +1204,10 @@ declare module 'util' {
1180
1204
  type: 'string' | 'boolean';
1181
1205
  short?: string;
1182
1206
  multiple?: boolean;
1207
+ /**
1208
+ * @since v18.11.0
1209
+ */
1210
+ default?: string | boolean | string[] | boolean[];
1183
1211
  }
1184
1212
 
1185
1213
  interface ParseArgsOptionsConfig {