@types/node 18.7.23 → 18.11.8

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/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
  */
@@ -1541,6 +1576,32 @@ declare module 'http' {
1541
1576
  */
1542
1577
  function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1543
1578
  function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1579
+
1580
+ /**
1581
+ * Performs the low-level validations on the provided name that are done when `res.setHeader(name, value)` is called.
1582
+ * Passing illegal value as name will result in a TypeError being thrown, identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1583
+ * @param name Header name
1584
+ * @since v14.3.0
1585
+ */
1586
+ function validateHeaderName(name: string): void;
1587
+ /**
1588
+ * Performs the low-level validations on the provided value that are done when `res.setHeader(name, value)` is called.
1589
+ * Passing illegal value as value will result in a TypeError being thrown.
1590
+ * - Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
1591
+ * - Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
1592
+ * @param name Header name
1593
+ * @param value Header value
1594
+ * @since v14.3.0
1595
+ */
1596
+ function validateHeaderValue(name: string, value: string): void;
1597
+
1598
+ /**
1599
+ * Set the maximum number of idle HTTP parsers. Default: 1000.
1600
+ * @param count
1601
+ * @since v18.8.0, v16.18.0
1602
+ */
1603
+ function setMaxIdleHTTPParsers(count: number): void;
1604
+
1544
1605
  let globalAgent: Agent;
1545
1606
  /**
1546
1607
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
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/index.d.ts CHANGED
@@ -47,6 +47,7 @@
47
47
  /// <reference path="dns/promises.d.ts" />
48
48
  /// <reference path="dns/promises.d.ts" />
49
49
  /// <reference path="domain.d.ts" />
50
+ /// <reference path="dom-events.d.ts" />
50
51
  /// <reference path="events.d.ts" />
51
52
  /// <reference path="fs.d.ts" />
52
53
  /// <reference path="fs/promises.d.ts" />
node/ts4.8/net.d.ts CHANGED
@@ -131,6 +131,17 @@ declare module 'net' {
131
131
  * @return The socket itself.
132
132
  */
133
133
  pause(): this;
134
+ /**
135
+ * Close the TCP connection by sending an RST packet and destroy the stream.
136
+ * If this TCP socket is in connecting status, it will send an RST packet
137
+ * and destroy this TCP socket once it is connected. Otherwise, it will call
138
+ * `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. If this is not a TCP socket
139
+ * (for example, a pipe), calling this method will immediately throw
140
+ * an `ERR_INVALID_HANDLE_TYPE` Error.
141
+ * @since v18.3.0
142
+ * @return The socket itself.
143
+ */
144
+ resetAndDestroy(): this;
134
145
  /**
135
146
  * Resumes reading after a call to `socket.pause()`.
136
147
  * @return The socket itself.
@@ -266,6 +277,11 @@ declare module 'net' {
266
277
  * @since v0.9.6
267
278
  */
268
279
  readonly localPort?: number;
280
+ /**
281
+ * The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
282
+ * @since v18.8.0
283
+ */
284
+ readonly localFamily?: string;
269
285
  /**
270
286
  * This property represents the state of the connection as a string.
271
287
  * @see {https://nodejs.org/api/net.html#socketreadystate}
@@ -315,7 +331,8 @@ declare module 'net' {
315
331
  * 5. end
316
332
  * 6. error
317
333
  * 7. lookup
318
- * 8. timeout
334
+ * 8. ready
335
+ * 9. timeout
319
336
  */
320
337
  addListener(event: string, listener: (...args: any[]) => void): this;
321
338
  addListener(event: 'close', listener: (hadError: boolean) => void): this;
@@ -422,6 +439,14 @@ declare module 'net' {
422
439
  */
423
440
  keepAliveInitialDelay?: number | undefined;
424
441
  }
442
+ interface DropArgument {
443
+ localAddress?: string;
444
+ localPort?: number;
445
+ localFamily?: string;
446
+ remoteAddress?: string;
447
+ remotePort?: number;
448
+ remoteFamily?: string;
449
+ }
425
450
  /**
426
451
  * This class is used to create a TCP or `IPC` server.
427
452
  * @since v0.1.90
@@ -558,37 +583,44 @@ declare module 'net' {
558
583
  * 2. connection
559
584
  * 3. error
560
585
  * 4. listening
586
+ * 5. drop
561
587
  */
562
588
  addListener(event: string, listener: (...args: any[]) => void): this;
563
589
  addListener(event: 'close', listener: () => void): this;
564
590
  addListener(event: 'connection', listener: (socket: Socket) => void): this;
565
591
  addListener(event: 'error', listener: (err: Error) => void): this;
566
592
  addListener(event: 'listening', listener: () => void): this;
593
+ addListener(event: 'drop', listener: (data?: DropArgument) => void): this;
567
594
  emit(event: string | symbol, ...args: any[]): boolean;
568
595
  emit(event: 'close'): boolean;
569
596
  emit(event: 'connection', socket: Socket): boolean;
570
597
  emit(event: 'error', err: Error): boolean;
571
598
  emit(event: 'listening'): boolean;
599
+ emit(event: 'drop', data?: DropArgument): boolean;
572
600
  on(event: string, listener: (...args: any[]) => void): this;
573
601
  on(event: 'close', listener: () => void): this;
574
602
  on(event: 'connection', listener: (socket: Socket) => void): this;
575
603
  on(event: 'error', listener: (err: Error) => void): this;
576
604
  on(event: 'listening', listener: () => void): this;
605
+ on(event: 'drop', listener: (data?: DropArgument) => void): this;
577
606
  once(event: string, listener: (...args: any[]) => void): this;
578
607
  once(event: 'close', listener: () => void): this;
579
608
  once(event: 'connection', listener: (socket: Socket) => void): this;
580
609
  once(event: 'error', listener: (err: Error) => void): this;
581
610
  once(event: 'listening', listener: () => void): this;
611
+ once(event: 'drop', listener: (data?: DropArgument) => void): this;
582
612
  prependListener(event: string, listener: (...args: any[]) => void): this;
583
613
  prependListener(event: 'close', listener: () => void): this;
584
614
  prependListener(event: 'connection', listener: (socket: Socket) => void): this;
585
615
  prependListener(event: 'error', listener: (err: Error) => void): this;
586
616
  prependListener(event: 'listening', listener: () => void): this;
617
+ prependListener(event: 'drop', listener: (data?: DropArgument) => void): this;
587
618
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
588
619
  prependOnceListener(event: 'close', listener: () => void): this;
589
620
  prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
590
621
  prependOnceListener(event: 'error', listener: (err: Error) => void): this;
591
622
  prependOnceListener(event: 'listening', listener: () => void): this;
623
+ prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
592
624
  }
593
625
  type IPVersion = 'ipv4' | 'ipv6';
594
626
  /**
@@ -814,7 +846,6 @@ declare module 'net' {
814
846
  class SocketAddress {
815
847
  constructor(options: SocketAddressInitOptions);
816
848
  /**
817
- * Either \`'ipv4'\` or \`'ipv6'\`.
818
849
  * @since v15.14.0, v14.18.0
819
850
  */
820
851
  readonly address: string;
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.
@@ -604,6 +604,21 @@ declare module 'perf_hooks' {
604
604
  * @since v15.9.0, v14.18.0
605
605
  */
606
606
  function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
607
+
608
+ import { performance as _performance } from 'perf_hooks';
609
+ global {
610
+ /**
611
+ * `performance` is a global reference for `require('perf_hooks').performance`
612
+ * https://nodejs.org/api/globals.html#performance
613
+ * @since v16.0.0
614
+ */
615
+ var performance: typeof globalThis extends {
616
+ onmessage: any;
617
+ performance: infer T;
618
+ }
619
+ ? T
620
+ : typeof _performance;
621
+ }
607
622
  }
608
623
  declare module 'node:perf_hooks' {
609
624
  export * from 'perf_hooks';
@@ -6,9 +6,9 @@
6
6
  * const querystring = require('querystring');
7
7
  * ```
8
8
  *
9
- * The `querystring` API is considered Legacy. While it is still maintained,
10
- * new code should use the `URLSearchParams` API instead.
11
- * @deprecated Legacy
9
+ * `querystring` is more performant than `URLSearchParams` but is not a
10
+ * standardized API. Use `URLSearchParams` when performance is not critical
11
+ * or when compatibility with browser code is desirable.
12
12
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
13
13
  */
14
14
  declare module 'querystring' {
@@ -1,22 +1,10 @@
1
- // Duplicates of interface in lib.dom.ts.
2
- // Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
3
- // Which in turn causes tests to pass that shouldn't pass.
4
- //
5
- // This interface is not, and should not be, exported.
6
- interface Blob {
7
- readonly size: number;
8
- readonly type: string;
9
- arrayBuffer(): Promise<ArrayBuffer>;
10
- slice(start?: number, end?: number, contentType?: string): Blob;
11
- stream(): NodeJS.ReadableStream;
12
- text(): Promise<string>;
13
- }
14
1
  declare module 'stream/consumers' {
2
+ import { Blob as NodeBlob } from "node:buffer";
15
3
  import { Readable } from 'node:stream';
16
4
  function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
17
5
  function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
18
6
  function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
19
- function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
7
+ function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
20
8
  function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
21
9
  }
22
10
  declare module 'node:stream/consumers' {
node/ts4.8/stream.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  */
19
19
  declare module 'stream' {
20
20
  import { EventEmitter, Abortable } from 'node:events';
21
+ import { Blob as NodeBlob } from "node:buffer";
21
22
  import * as streamPromises from 'node:stream/promises';
22
23
  import * as streamConsumers from 'node:stream/consumers';
23
24
  import * as streamWeb from 'node:stream/web';
@@ -892,7 +893,7 @@ declare module 'stream' {
892
893
  *
893
894
  * @since v16.8.0
894
895
  */
895
- 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;
896
897
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
897
898
  _writev?(
898
899
  chunks: Array<{
node/ts4.8/test.d.ts CHANGED
@@ -3,6 +3,14 @@
3
3
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/test.js)
4
4
  */
5
5
  declare module 'node:test' {
6
+ /**
7
+ * Programmatically start the test runner.
8
+ * @since v18.9.0
9
+ * @param options Configuration options for running tests.
10
+ * @returns A {@link TapStream} that emits events about the test execution.
11
+ */
12
+ function run(options?: RunOptions): TapStream;
13
+
6
14
  /**
7
15
  * The `test()` function is the value imported from the test module. Each invocation of this
8
16
  * function results in the creation of a test point in the TAP output.
@@ -42,7 +50,7 @@ declare module 'node:test' {
42
50
  function test(options?: TestOptions, fn?: TestFn): Promise<void>;
43
51
  function test(fn?: TestFn): Promise<void>;
44
52
 
45
- /*
53
+ /**
46
54
  * @since v18.6.0
47
55
  * @param name The name of the suite, which is displayed when reporting suite results.
48
56
  * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
@@ -54,7 +62,7 @@ declare module 'node:test' {
54
62
  function describe(options?: TestOptions, fn?: SuiteFn): void;
55
63
  function describe(fn?: SuiteFn): void;
56
64
 
57
- /*
65
+ /**
58
66
  * @since v18.6.0
59
67
  * @param name The name of the test, which is displayed when reporting test results.
60
68
  * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
@@ -86,6 +94,122 @@ declare module 'node:test' {
86
94
  */
87
95
  type ItFn = (done: (result?: any) => void) => any;
88
96
 
97
+ interface RunOptions {
98
+ /**
99
+ * @default false
100
+ */
101
+ concurrency?: number | boolean;
102
+
103
+ /**
104
+ * An array containing the list of files to run. If unspecified, the test runner execution model will be used.
105
+ */
106
+ files?: readonly string[];
107
+
108
+ /**
109
+ * Allows aborting an in-progress test.
110
+ * @default undefined
111
+ */
112
+ signal?: AbortSignal;
113
+
114
+ /**
115
+ * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
116
+ * value from their parent.
117
+ * @default Infinity
118
+ */
119
+ timeout?: number;
120
+ }
121
+
122
+ /**
123
+ * A successful call of the run() method will return a new TapStream object, streaming a TAP output.
124
+ * TapStream will emit events in the order of the tests' definitions.
125
+ * @since v18.9.0
126
+ */
127
+ interface TapStream extends NodeJS.ReadableStream {
128
+ addListener(event: 'test:diagnostic', listener: (message: string) => void): this;
129
+ addListener(event: 'test:fail', listener: (data: TestFail) => void): this;
130
+ addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
131
+ addListener(event: string, listener: (...args: any[]) => void): this;
132
+ emit(event: 'test:diagnostic', message: string): boolean;
133
+ emit(event: 'test:fail', data: TestFail): boolean;
134
+ emit(event: 'test:pass', data: TestPass): boolean;
135
+ emit(event: string | symbol, ...args: any[]): boolean;
136
+ on(event: 'test:diagnostic', listener: (message: string) => void): this;
137
+ on(event: 'test:fail', listener: (data: TestFail) => void): this;
138
+ on(event: 'test:pass', listener: (data: TestPass) => void): this;
139
+ on(event: string, listener: (...args: any[]) => void): this;
140
+ once(event: 'test:diagnostic', listener: (message: string) => void): this;
141
+ once(event: 'test:fail', listener: (data: TestFail) => void): this;
142
+ once(event: 'test:pass', listener: (data: TestPass) => void): this;
143
+ once(event: string, listener: (...args: any[]) => void): this;
144
+ prependListener(event: 'test:diagnostic', listener: (message: string) => void): this;
145
+ prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
146
+ prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
147
+ prependListener(event: string, listener: (...args: any[]) => void): this;
148
+ prependOnceListener(event: 'test:diagnostic', listener: (message: string) => void): this;
149
+ prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
150
+ prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
151
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
152
+ }
153
+
154
+ interface TestFail {
155
+ /**
156
+ * The test duration.
157
+ */
158
+ duration: number;
159
+
160
+ /**
161
+ * The failure casing test to fail.
162
+ */
163
+ error: Error;
164
+
165
+ /**
166
+ * The test name.
167
+ */
168
+ name: string;
169
+
170
+ /**
171
+ * The ordinal number of the test.
172
+ */
173
+ testNumber: number;
174
+
175
+ /**
176
+ * Present if `context.todo` is called.
177
+ */
178
+ todo?: string;
179
+
180
+ /**
181
+ * Present if `context.skip` is called.
182
+ */
183
+ skip?: string;
184
+ }
185
+
186
+ interface TestPass {
187
+ /**
188
+ * The test duration.
189
+ */
190
+ duration: number;
191
+
192
+ /**
193
+ * The test name.
194
+ */
195
+ name: string;
196
+
197
+ /**
198
+ * The ordinal number of the test.
199
+ */
200
+ testNumber: number;
201
+
202
+ /**
203
+ * Present if `context.todo` is called.
204
+ */
205
+ todo?: string;
206
+
207
+ /**
208
+ * Present if `context.skip` is called.
209
+ */
210
+ skip?: string;
211
+ }
212
+
89
213
  /**
90
214
  * An instance of `TestContext` is passed to each test function in order to interact with the
91
215
  * test runner. However, the `TestContext` constructor is not exposed as part of the API.
@@ -159,7 +283,7 @@ declare module 'node:test' {
159
283
 
160
284
  /**
161
285
  * Allows aborting an in-progress test.
162
- * @since 8.7.0
286
+ * @since v18.8.0
163
287
  */
164
288
  signal?: AbortSignal;
165
289
 
@@ -174,7 +298,7 @@ declare module 'node:test' {
174
298
  * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
175
299
  * value from their parent.
176
300
  * @default Infinity
177
- * @since 8.7.0
301
+ * @since v18.7.0
178
302
  */
179
303
  timeout?: number;
180
304
 
@@ -186,5 +310,5 @@ declare module 'node:test' {
186
310
  todo?: boolean | string;
187
311
  }
188
312
 
189
- export { test as default, test, describe, it };
313
+ export { test as default, run, test, describe, it };
190
314
  }
node/ts4.8/url.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
9
9
  */
10
10
  declare module 'url' {
11
- import { Blob } from 'node:buffer';
11
+ import { Blob as NodeBlob } from 'node:buffer';
12
12
  import { ClientRequestArgs } from 'node:http';
13
13
  import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring';
14
14
  // Input to `url.format`
@@ -395,7 +395,7 @@ declare module 'url' {
395
395
  * @since v16.7.0
396
396
  * @experimental
397
397
  */
398
- static createObjectURL(blob: Blob): string;
398
+ static createObjectURL(blob: NodeBlob): string;
399
399
  /**
400
400
  * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
401
401
  * ID that isn’t registered will silently fail.
@@ -875,9 +875,9 @@ declare module 'url' {
875
875
  */
876
876
  var URL: typeof globalThis extends {
877
877
  onmessage: any;
878
- URL: infer URL;
878
+ URL: infer T;
879
879
  }
880
- ? URL
880
+ ? T
881
881
  : typeof _URL;
882
882
  /**
883
883
  * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
@@ -886,9 +886,9 @@ declare module 'url' {
886
886
  */
887
887
  var URLSearchParams: typeof globalThis extends {
888
888
  onmessage: any;
889
- URLSearchParams: infer URLSearchParams;
889
+ URLSearchParams: infer T;
890
890
  }
891
- ? URLSearchParams
891
+ ? T
892
892
  : typeof _URLSearchParams;
893
893
  }
894
894
  }
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
@@ -1067,6 +1088,8 @@ declare module 'util' {
1067
1088
  written: number;
1068
1089
  }
1069
1090
  export { types };
1091
+
1092
+ //// TextEncoder/Decoder
1070
1093
  /**
1071
1094
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
1072
1095
  * instances of `TextEncoder` only support UTF-8 encoding.
@@ -1106,6 +1129,34 @@ declare module 'util' {
1106
1129
  encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1107
1130
  }
1108
1131
 
1132
+ import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'util';
1133
+ global {
1134
+ /**
1135
+ * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1136
+ * https://nodejs.org/api/globals.html#textdecoder
1137
+ * @since v11.0.0
1138
+ */
1139
+ var TextDecoder: typeof globalThis extends {
1140
+ onmessage: any;
1141
+ TextDecoder: infer TextDecoder;
1142
+ }
1143
+ ? TextDecoder
1144
+ : typeof _TextDecoder;
1145
+
1146
+ /**
1147
+ * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1148
+ * https://nodejs.org/api/globals.html#textencoder
1149
+ * @since v11.0.0
1150
+ */
1151
+ var TextEncoder: typeof globalThis extends {
1152
+ onmessage: any;
1153
+ TextEncoder: infer TextEncoder;
1154
+ }
1155
+ ? TextEncoder
1156
+ : typeof _TextEncoder;
1157
+ }
1158
+
1159
+ //// parseArgs
1109
1160
  /**
1110
1161
  * Provides a high-level API for command-line argument parsing. Takes a
1111
1162
  * specification for the expected arguments and returns a structured object
@@ -1125,6 +1176,9 @@ declare module 'util' {
1125
1176
  * times. If `true`, all values will be collected in an array. If
1126
1177
  * `false`, values for the option are last-wins. **Default:** `false`.
1127
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.
1128
1182
  *
1129
1183
  * - `strict`: Whether an error should be thrown when unknown arguments
1130
1184
  * are encountered, or when arguments are passed that do not match the
@@ -1150,6 +1204,10 @@ declare module 'util' {
1150
1204
  type: 'string' | 'boolean';
1151
1205
  short?: string;
1152
1206
  multiple?: boolean;
1207
+ /**
1208
+ * @since v18.11.0
1209
+ */
1210
+ default?: string | boolean | string[] | boolean[];
1153
1211
  }
1154
1212
 
1155
1213
  interface ParseArgsOptionsConfig {