@types/node 18.11.5 → 20.2.5

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.
Files changed (97) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +86 -75
  3. node/async_hooks.d.ts +66 -37
  4. node/buffer.d.ts +193 -100
  5. node/child_process.d.ts +82 -56
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +233 -235
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +59 -21
  11. node/dns/promises.d.ts +50 -6
  12. node/dns.d.ts +26 -17
  13. node/domain.d.ts +4 -4
  14. node/events.d.ts +111 -65
  15. node/fs/promises.d.ts +99 -47
  16. node/fs.d.ts +244 -73
  17. node/globals.d.ts +6 -3
  18. node/http.d.ts +265 -148
  19. node/http2.d.ts +42 -47
  20. node/https.d.ts +53 -153
  21. node/index.d.ts +2 -1
  22. node/inspector.d.ts +10 -3
  23. node/module.d.ts +6 -4
  24. node/net.d.ts +32 -15
  25. node/os.d.ts +27 -16
  26. node/package.json +9 -4
  27. node/path.d.ts +4 -4
  28. node/perf_hooks.d.ts +28 -15
  29. node/process.d.ts +49 -46
  30. node/punycode.d.ts +1 -1
  31. node/querystring.d.ts +5 -5
  32. node/readline/promises.d.ts +65 -63
  33. node/readline.d.ts +32 -159
  34. node/repl.d.ts +20 -20
  35. node/stream/consumers.d.ts +1 -1
  36. node/stream.d.ts +950 -869
  37. node/string_decoder.d.ts +6 -6
  38. node/test.d.ts +877 -139
  39. node/timers/promises.d.ts +26 -1
  40. node/timers.d.ts +125 -4
  41. node/tls.d.ts +120 -29
  42. node/trace_events.d.ts +20 -9
  43. node/ts4.8/assert.d.ts +86 -75
  44. node/ts4.8/async_hooks.d.ts +66 -37
  45. node/ts4.8/buffer.d.ts +193 -101
  46. node/ts4.8/child_process.d.ts +82 -56
  47. node/ts4.8/cluster.d.ts +12 -12
  48. node/ts4.8/console.d.ts +5 -5
  49. node/ts4.8/crypto.d.ts +230 -233
  50. node/ts4.8/dgram.d.ts +15 -15
  51. node/ts4.8/diagnostics_channel.d.ts +59 -21
  52. node/ts4.8/dns/promises.d.ts +50 -6
  53. node/ts4.8/dns.d.ts +26 -17
  54. node/ts4.8/domain.d.ts +4 -4
  55. node/ts4.8/events.d.ts +111 -65
  56. node/ts4.8/fs/promises.d.ts +97 -46
  57. node/ts4.8/fs.d.ts +244 -73
  58. node/ts4.8/globals.d.ts +21 -12
  59. node/ts4.8/http.d.ts +265 -148
  60. node/ts4.8/http2.d.ts +42 -47
  61. node/ts4.8/https.d.ts +53 -153
  62. node/ts4.8/inspector.d.ts +10 -3
  63. node/ts4.8/module.d.ts +6 -4
  64. node/ts4.8/net.d.ts +33 -16
  65. node/ts4.8/os.d.ts +27 -16
  66. node/ts4.8/path.d.ts +4 -4
  67. node/ts4.8/perf_hooks.d.ts +28 -15
  68. node/ts4.8/process.d.ts +49 -46
  69. node/ts4.8/punycode.d.ts +1 -1
  70. node/ts4.8/querystring.d.ts +5 -5
  71. node/ts4.8/readline/promises.d.ts +65 -63
  72. node/ts4.8/readline.d.ts +32 -159
  73. node/ts4.8/repl.d.ts +20 -20
  74. node/ts4.8/stream/consumers.d.ts +1 -1
  75. node/ts4.8/stream.d.ts +192 -140
  76. node/ts4.8/string_decoder.d.ts +6 -6
  77. node/ts4.8/test.d.ts +877 -139
  78. node/ts4.8/timers/promises.d.ts +26 -1
  79. node/ts4.8/timers.d.ts +125 -4
  80. node/ts4.8/tls.d.ts +120 -29
  81. node/ts4.8/trace_events.d.ts +20 -9
  82. node/ts4.8/tty.d.ts +4 -5
  83. node/ts4.8/url.d.ts +46 -42
  84. node/ts4.8/util.d.ts +325 -123
  85. node/ts4.8/v8.d.ts +253 -14
  86. node/ts4.8/vm.d.ts +417 -32
  87. node/ts4.8/wasi.d.ts +13 -19
  88. node/ts4.8/worker_threads.d.ts +38 -34
  89. node/ts4.8/zlib.d.ts +11 -11
  90. node/tty.d.ts +4 -5
  91. node/url.d.ts +46 -42
  92. node/util.d.ts +325 -123
  93. node/v8.d.ts +253 -14
  94. node/vm.d.ts +417 -32
  95. node/wasi.d.ts +13 -19
  96. node/worker_threads.d.ts +38 -34
  97. node/zlib.d.ts +11 -11
node/http2.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * The `http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. It
3
- * can be accessed using:
2
+ * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
3
+ * It can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const http2 = require('http2');
6
+ * const http2 = require('node:http2');
7
7
  * ```
8
8
  * @since v8.4.0
9
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/http2.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http2.js)
10
10
  */
11
11
  declare module 'http2' {
12
12
  import EventEmitter = require('node:events');
@@ -151,7 +151,7 @@ declare module 'http2' {
151
151
  priority(options: StreamPriorityOptions): void;
152
152
  /**
153
153
  * ```js
154
- * const http2 = require('http2');
154
+ * const http2 = require('node:http2');
155
155
  * const client = http2.connect('http://example.org:8000');
156
156
  * const { NGHTTP2_CANCEL } = http2.constants;
157
157
  * const req = client.request({ ':path': '/' });
@@ -171,7 +171,7 @@ declare module 'http2' {
171
171
  * trailers can be sent.
172
172
  *
173
173
  * ```js
174
- * const http2 = require('http2');
174
+ * const http2 = require('node:http2');
175
175
  * const server = http2.createServer();
176
176
  * server.on('stream', (stream) => {
177
177
  * stream.respond(undefined, { waitForTrailers: true });
@@ -332,7 +332,7 @@ declare module 'http2' {
332
332
  * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument.
333
333
  *
334
334
  * ```js
335
- * const http2 = require('http2');
335
+ * const http2 = require('node:http2');
336
336
  * const server = http2.createServer();
337
337
  * server.on('stream', (stream) => {
338
338
  * stream.respond({ ':status': 200 });
@@ -357,7 +357,7 @@ declare module 'http2' {
357
357
  pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
358
358
  /**
359
359
  * ```js
360
- * const http2 = require('http2');
360
+ * const http2 = require('node:http2');
361
361
  * const server = http2.createServer();
362
362
  * server.on('stream', (stream) => {
363
363
  * stream.respond({ ':status': 200 });
@@ -365,16 +365,15 @@ declare module 'http2' {
365
365
  * });
366
366
  * ```
367
367
  *
368
- * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
369
- * will be emitted immediately after queuing the last chunk of payload data to be
370
- * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing
371
- * header fields to the peer.
368
+ * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk
369
+ * of payload data to be sent. The `http2stream.sendTrailers()` method can then be
370
+ * used to sent trailing header fields to the peer.
372
371
  *
373
372
  * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
374
373
  * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
375
374
  *
376
375
  * ```js
377
- * const http2 = require('http2');
376
+ * const http2 = require('node:http2');
378
377
  * const server = http2.createServer();
379
378
  * server.on('stream', (stream) => {
380
379
  * stream.respond({ ':status': 200 }, { waitForTrailers: true });
@@ -397,8 +396,8 @@ declare module 'http2' {
397
396
  * automatically.
398
397
  *
399
398
  * ```js
400
- * const http2 = require('http2');
401
- * const fs = require('fs');
399
+ * const http2 = require('node:http2');
400
+ * const fs = require('node:fs');
402
401
  *
403
402
  * const server = http2.createServer();
404
403
  * server.on('stream', (stream) => {
@@ -408,7 +407,7 @@ declare module 'http2' {
408
407
  * const headers = {
409
408
  * 'content-length': stat.size,
410
409
  * 'last-modified': stat.mtime.toUTCString(),
411
- * 'content-type': 'text/plain; charset=utf-8'
410
+ * 'content-type': 'text/plain; charset=utf-8',
412
411
  * };
413
412
  * stream.respondWithFD(fd, headers);
414
413
  * stream.on('close', () => fs.closeSync(fd));
@@ -439,8 +438,8 @@ declare module 'http2' {
439
438
  * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
440
439
  *
441
440
  * ```js
442
- * const http2 = require('http2');
443
- * const fs = require('fs');
441
+ * const http2 = require('node:http2');
442
+ * const fs = require('node:fs');
444
443
  *
445
444
  * const server = http2.createServer();
446
445
  * server.on('stream', (stream) => {
@@ -450,7 +449,7 @@ declare module 'http2' {
450
449
  * const headers = {
451
450
  * 'content-length': stat.size,
452
451
  * 'last-modified': stat.mtime.toUTCString(),
453
- * 'content-type': 'text/plain; charset=utf-8'
452
+ * 'content-type': 'text/plain; charset=utf-8',
454
453
  * };
455
454
  * stream.respondWithFD(fd, headers, { waitForTrailers: true });
456
455
  * stream.on('wantTrailers', () => {
@@ -482,7 +481,7 @@ declare module 'http2' {
482
481
  * Example using a file path:
483
482
  *
484
483
  * ```js
485
- * const http2 = require('http2');
484
+ * const http2 = require('node:http2');
486
485
  * const server = http2.createServer();
487
486
  * server.on('stream', (stream) => {
488
487
  * function statCheck(stat, headers) {
@@ -500,7 +499,7 @@ declare module 'http2' {
500
499
  * }
501
500
  * } catch (err) {
502
501
  * // Perform actual error handling.
503
- * console.log(err);
502
+ * console.error(err);
504
503
  * }
505
504
  * stream.end();
506
505
  * }
@@ -516,7 +515,7 @@ declare module 'http2' {
516
515
  * results to determine if the file has been modified to return an appropriate`304` response:
517
516
  *
518
517
  * ```js
519
- * const http2 = require('http2');
518
+ * const http2 = require('node:http2');
520
519
  * const server = http2.createServer();
521
520
  * server.on('stream', (stream) => {
522
521
  * function statCheck(stat, headers) {
@@ -549,7 +548,7 @@ declare module 'http2' {
549
548
  * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
550
549
  *
551
550
  * ```js
552
- * const http2 = require('http2');
551
+ * const http2 = require('node:http2');
553
552
  * const server = http2.createServer();
554
553
  * server.on('stream', (stream) => {
555
554
  * stream.respondWithFile('/some/file',
@@ -748,7 +747,7 @@ declare module 'http2' {
748
747
  * the delta.
749
748
  *
750
749
  * ```js
751
- * const http2 = require('http2');
750
+ * const http2 = require('node:http2');
752
751
  *
753
752
  * const server = http2.createServer();
754
753
  * const expectedWindowSize = 2 ** 20;
@@ -854,11 +853,11 @@ declare module 'http2' {
854
853
  * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
855
854
  *
856
855
  * ```js
857
- * const http2 = require('http2');
856
+ * const http2 = require('node:http2');
858
857
  * const clientSession = http2.connect('https://localhost:1234');
859
858
  * const {
860
859
  * HTTP2_HEADER_PATH,
861
- * HTTP2_HEADER_STATUS
860
+ * HTTP2_HEADER_STATUS,
862
861
  * } = http2.constants;
863
862
  *
864
863
  * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
@@ -928,7 +927,7 @@ declare module 'http2' {
928
927
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
929
928
  *
930
929
  * ```js
931
- * const http2 = require('http2');
930
+ * const http2 = require('node:http2');
932
931
  *
933
932
  * const server = http2.createServer();
934
933
  * server.on('session', (session) => {
@@ -969,7 +968,7 @@ declare module 'http2' {
969
968
  * authoritative responses.
970
969
  *
971
970
  * ```js
972
- * const http2 = require('http2');
971
+ * const http2 = require('node:http2');
973
972
  * const options = getSecureOptionsSomehow();
974
973
  * const server = http2.createSecureServer(options);
975
974
  * server.on('stream', (stream) => {
@@ -995,7 +994,7 @@ declare module 'http2' {
995
994
  * server using the `http2.createSecureServer()` method:
996
995
  *
997
996
  * ```js
998
- * const http2 = require('http2');
997
+ * const http2 = require('node:http2');
999
998
  * const options = getSecureOptionsSomehow();
1000
999
  * options.origins = ['https://example.com', 'https://example.org'];
1001
1000
  * const server = http2.createSecureServer(options);
@@ -1053,7 +1052,6 @@ declare module 'http2' {
1053
1052
  */
1054
1053
  unknownProtocolTimeout?: number | undefined;
1055
1054
  selectPadding?(frameLen: number, maxFrameLen: number): number;
1056
- createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
1057
1055
  }
1058
1056
  export interface ClientSessionOptions extends SessionOptions {
1059
1057
  maxReservedRemoteStreams?: number | undefined;
@@ -1437,7 +1435,7 @@ declare module 'http2' {
1437
1435
  */
1438
1436
  readonly headersSent: boolean;
1439
1437
  /**
1440
- * A reference to the original HTTP2 request object.
1438
+ * A reference to the original HTTP2 `request` object.
1441
1439
  * @since v15.7.0
1442
1440
  */
1443
1441
  readonly req: Http2ServerRequest;
@@ -1458,7 +1456,7 @@ declare module 'http2' {
1458
1456
  * All other interactions will be routed directly to the socket.
1459
1457
  *
1460
1458
  * ```js
1461
- * const http2 = require('http2');
1459
+ * const http2 = require('node:http2');
1462
1460
  * const server = http2.createServer((req, res) => {
1463
1461
  * const ip = req.socket.remoteAddress;
1464
1462
  * const port = req.socket.remotePort;
@@ -1641,7 +1639,7 @@ declare module 'http2' {
1641
1639
  * This sends a chunk of the response body. This method may
1642
1640
  * be called multiple times to provide successive parts of the body.
1643
1641
  *
1644
- * In the `http` module, the response body is omitted when the
1642
+ * In the `node:http` module, the response body is omitted when the
1645
1643
  * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
1646
1644
  *
1647
1645
  * `chunk` can be a string or a buffer. If `chunk` is a string,
@@ -1676,7 +1674,7 @@ declare module 'http2' {
1676
1674
  * The `hints` is an object containing the values of headers to be sent with
1677
1675
  * early hints message.
1678
1676
  *
1679
- * Example:
1677
+ * **Example**
1680
1678
  *
1681
1679
  * ```js
1682
1680
  * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
@@ -1690,12 +1688,9 @@ declare module 'http2' {
1690
1688
  * ];
1691
1689
  * response.writeEarlyHints({
1692
1690
  * 'link': earlyHintsLinks,
1693
- * 'x-trace-id': 'id for diagnostics'
1694
1691
  * });
1695
1692
  * ```
1696
- *
1697
1693
  * @since v18.11.0
1698
- * @param hints An object containing the values of headers
1699
1694
  */
1700
1695
  writeEarlyHints(hints: Record<string, string | string[]>): void;
1701
1696
  /**
@@ -2028,7 +2023,7 @@ declare module 'http2' {
2028
2023
  * for use with the `HTTP2-Settings` header field.
2029
2024
  *
2030
2025
  * ```js
2031
- * const http2 = require('http2');
2026
+ * const http2 = require('node:http2');
2032
2027
  *
2033
2028
  * const packed = http2.getPackedSettings({ enablePush: false });
2034
2029
  *
@@ -2053,7 +2048,7 @@ declare module 'http2' {
2053
2048
  * with browser clients.
2054
2049
  *
2055
2050
  * ```js
2056
- * const http2 = require('http2');
2051
+ * const http2 = require('node:http2');
2057
2052
  *
2058
2053
  * // Create an unencrypted HTTP/2 server.
2059
2054
  * // Since there are no browsers known that support
@@ -2064,12 +2059,12 @@ declare module 'http2' {
2064
2059
  * server.on('stream', (stream, headers) => {
2065
2060
  * stream.respond({
2066
2061
  * 'content-type': 'text/html; charset=utf-8',
2067
- * ':status': 200
2062
+ * ':status': 200,
2068
2063
  * });
2069
2064
  * stream.end('<h1>Hello World</h1>');
2070
2065
  * });
2071
2066
  *
2072
- * server.listen(80);
2067
+ * server.listen(8000);
2073
2068
  * ```
2074
2069
  * @since v8.4.0
2075
2070
  * @param onRequestHandler See `Compatibility API`
@@ -2080,12 +2075,12 @@ declare module 'http2' {
2080
2075
  * Returns a `tls.Server` instance that creates and manages `Http2Session`instances.
2081
2076
  *
2082
2077
  * ```js
2083
- * const http2 = require('http2');
2084
- * const fs = require('fs');
2078
+ * const http2 = require('node:http2');
2079
+ * const fs = require('node:fs');
2085
2080
  *
2086
2081
  * const options = {
2087
2082
  * key: fs.readFileSync('server-key.pem'),
2088
- * cert: fs.readFileSync('server-cert.pem')
2083
+ * cert: fs.readFileSync('server-cert.pem'),
2089
2084
  * };
2090
2085
  *
2091
2086
  * // Create a secure HTTP/2 server
@@ -2094,12 +2089,12 @@ declare module 'http2' {
2094
2089
  * server.on('stream', (stream, headers) => {
2095
2090
  * stream.respond({
2096
2091
  * 'content-type': 'text/html; charset=utf-8',
2097
- * ':status': 200
2092
+ * ':status': 200,
2098
2093
  * });
2099
2094
  * stream.end('<h1>Hello World</h1>');
2100
2095
  * });
2101
2096
  *
2102
- * server.listen(80);
2097
+ * server.listen(8443);
2103
2098
  * ```
2104
2099
  * @since v8.4.0
2105
2100
  * @param onRequestHandler See `Compatibility API`
@@ -2110,7 +2105,7 @@ declare module 'http2' {
2110
2105
  * Returns a `ClientHttp2Session` instance.
2111
2106
  *
2112
2107
  * ```js
2113
- * const http2 = require('http2');
2108
+ * const http2 = require('node:http2');
2114
2109
  * const client = http2.connect('https://localhost:1234');
2115
2110
  *
2116
2111
  * // Use the client