@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/dgram.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * The `dgram` module provides an implementation of UDP datagram sockets.
2
+ * The `node:dgram` module provides an implementation of UDP datagram sockets.
3
3
  *
4
4
  * ```js
5
- * import dgram from 'dgram';
5
+ * import dgram from 'node:dgram';
6
6
  *
7
7
  * const server = dgram.createSocket('udp4');
8
8
  *
9
9
  * server.on('error', (err) => {
10
- * console.log(`server error:\n${err.stack}`);
10
+ * console.error(`server error:\n${err.stack}`);
11
11
  * server.close();
12
12
  * });
13
13
  *
@@ -23,7 +23,7 @@
23
23
  * server.bind(41234);
24
24
  * // Prints: server listening 0.0.0.0:41234
25
25
  * ```
26
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
26
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js)
27
27
  */
28
28
  declare module 'dgram' {
29
29
  import { AddressInfo } from 'node:net';
@@ -98,8 +98,8 @@ declare module 'dgram' {
98
98
  * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
99
99
  *
100
100
  * ```js
101
- * import cluster from 'cluster';
102
- * import dgram from 'dgram';
101
+ * import cluster from 'node:cluster';
102
+ * import dgram from 'node:dgram';
103
103
  *
104
104
  * if (cluster.isPrimary) {
105
105
  * cluster.fork(); // Works ok.
@@ -116,7 +116,7 @@ declare module 'dgram' {
116
116
  addMembership(multicastAddress: string, multicastInterface?: string): void;
117
117
  /**
118
118
  * Returns an object containing the address information for a socket.
119
- * For UDP sockets, this object will contain `address`, `family` and `port`properties.
119
+ * For UDP sockets, this object will contain `address`, `family`, and `port`properties.
120
120
  *
121
121
  * This method throws `EBADF` if called on an unbound socket.
122
122
  * @since v0.1.99
@@ -142,12 +142,12 @@ declare module 'dgram' {
142
142
  * Example of a UDP server listening on port 41234:
143
143
  *
144
144
  * ```js
145
- * import dgram from 'dgram';
145
+ * import dgram from 'node:dgram';
146
146
  *
147
147
  * const server = dgram.createSocket('udp4');
148
148
  *
149
149
  * server.on('error', (err) => {
150
- * console.log(`server error:\n${err.stack}`);
150
+ * console.error(`server error:\n${err.stack}`);
151
151
  * server.close();
152
152
  * });
153
153
  *
@@ -284,8 +284,8 @@ declare module 'dgram' {
284
284
  * Example of sending a UDP packet to a port on `localhost`;
285
285
  *
286
286
  * ```js
287
- * import dgram from 'dgram';
288
- * import { Buffer } from 'buffer';
287
+ * import dgram from 'node:dgram';
288
+ * import { Buffer } from 'node:buffer';
289
289
  *
290
290
  * const message = Buffer.from('Some bytes');
291
291
  * const client = dgram.createSocket('udp4');
@@ -297,8 +297,8 @@ declare module 'dgram' {
297
297
  * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
298
298
  *
299
299
  * ```js
300
- * import dgram from 'dgram';
301
- * import { Buffer } from 'buffer';
300
+ * import dgram from 'node:dgram';
301
+ * import { Buffer } from 'node:buffer';
302
302
  *
303
303
  * const buf1 = Buffer.from('Some ');
304
304
  * const buf2 = Buffer.from('bytes');
@@ -316,8 +316,8 @@ declare module 'dgram' {
316
316
  * Example of sending a UDP packet using a socket connected to a port on`localhost`:
317
317
  *
318
318
  * ```js
319
- * import dgram from 'dgram';
320
- * import { Buffer } from 'buffer';
319
+ * import dgram from 'node:dgram';
320
+ * import { Buffer } from 'node:buffer';
321
321
  *
322
322
  * const message = Buffer.from('Some bytes');
323
323
  * const client = dgram.createSocket('udp4');
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The `diagnostics_channel` module provides an API to create named channels
2
+ * The `node:diagnostics_channel` module provides an API to create named channels
3
3
  * to report arbitrary message data for diagnostics purposes.
4
4
  *
5
5
  * It can be accessed using:
6
6
  *
7
7
  * ```js
8
- * import diagnostics_channel from 'diagnostics_channel';
8
+ * import diagnostics_channel from 'node:diagnostics_channel';
9
9
  * ```
10
10
  *
11
11
  * It is intended that a module writer wanting to report diagnostics messages
@@ -19,8 +19,8 @@
19
19
  * channels are used along with the shape of the message data. Channel names
20
20
  * should generally include the module name to avoid collisions with data from
21
21
  * other modules.
22
- * @experimental
23
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
22
+ * @since v15.1.0, v14.17.0
23
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js)
24
24
  */
25
25
  declare module 'diagnostics_channel' {
26
26
  /**
@@ -31,7 +31,7 @@ declare module 'diagnostics_channel' {
31
31
  * performance-sensitive code.
32
32
  *
33
33
  * ```js
34
- * import diagnostics_channel from 'diagnostics_channel';
34
+ * import diagnostics_channel from 'node:diagnostics_channel';
35
35
  *
36
36
  * if (diagnostics_channel.hasSubscribers('my-channel')) {
37
37
  * // There are subscribers, prepare and publish message
@@ -41,14 +41,14 @@ declare module 'diagnostics_channel' {
41
41
  * @param name The channel name
42
42
  * @return If there are active subscribers
43
43
  */
44
- function hasSubscribers(name: string): boolean;
44
+ function hasSubscribers(name: string | symbol): boolean;
45
45
  /**
46
- * This is the primary entry-point for anyone wanting to interact with a named
46
+ * This is the primary entry-point for anyone wanting to publish to a named
47
47
  * channel. It produces a channel object which is optimized to reduce overhead at
48
48
  * publish time as much as possible.
49
49
  *
50
50
  * ```js
51
- * import diagnostics_channel from 'diagnostics_channel';
51
+ * import diagnostics_channel from 'node:diagnostics_channel';
52
52
  *
53
53
  * const channel = diagnostics_channel.channel('my-channel');
54
54
  * ```
@@ -56,11 +56,48 @@ declare module 'diagnostics_channel' {
56
56
  * @param name The channel name
57
57
  * @return The named channel object
58
58
  */
59
- function channel(name: string): Channel;
60
- type ChannelListener = (message: unknown, name: string) => void;
59
+ function channel(name: string | symbol): Channel;
60
+ type ChannelListener = (message: unknown, name: string | symbol) => void;
61
+ /**
62
+ * Register a message handler to subscribe to this channel. This message handler
63
+ * will be run synchronously whenever a message is published to the channel. Any
64
+ * errors thrown in the message handler will trigger an `'uncaughtException'`.
65
+ *
66
+ * ```js
67
+ * import diagnostics_channel from 'node:diagnostics_channel';
68
+ *
69
+ * diagnostics_channel.subscribe('my-channel', (message, name) => {
70
+ * // Received data
71
+ * });
72
+ * ```
73
+ * @since v18.7.0, v16.17.0
74
+ * @param name The channel name
75
+ * @param onMessage The handler to receive channel messages
76
+ */
77
+ function subscribe(name: string | symbol, onMessage: ChannelListener): void;
78
+ /**
79
+ * Remove a message handler previously registered to this channel with {@link subscribe}.
80
+ *
81
+ * ```js
82
+ * import diagnostics_channel from 'node:diagnostics_channel';
83
+ *
84
+ * function onMessage(message, name) {
85
+ * // Received data
86
+ * }
87
+ *
88
+ * diagnostics_channel.subscribe('my-channel', onMessage);
89
+ *
90
+ * diagnostics_channel.unsubscribe('my-channel', onMessage);
91
+ * ```
92
+ * @since v18.7.0, v16.17.0
93
+ * @param name The channel name
94
+ * @param onMessage The previous subscribed handler to remove
95
+ * @return `true` if the handler was found, `false` otherwise.
96
+ */
97
+ function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
61
98
  /**
62
99
  * The class `Channel` represents an individual named channel within the data
63
- * pipeline. It is use to track subscribers and to publish messages when there
100
+ * pipeline. It is used to track subscribers and to publish messages when there
64
101
  * are subscribers present. It exists as a separate object to avoid channel
65
102
  * lookups at publish time, enabling very fast publish speeds and allowing
66
103
  * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
@@ -68,7 +105,7 @@ declare module 'diagnostics_channel' {
68
105
  * @since v15.1.0, v14.17.0
69
106
  */
70
107
  class Channel {
71
- readonly name: string;
108
+ readonly name: string | symbol;
72
109
  /**
73
110
  * Check if there are active subscribers to this channel. This is helpful if
74
111
  * the message you want to send might be expensive to prepare.
@@ -77,7 +114,7 @@ declare module 'diagnostics_channel' {
77
114
  * performance-sensitive code.
78
115
  *
79
116
  * ```js
80
- * import diagnostics_channel from 'diagnostics_channel';
117
+ * import diagnostics_channel from 'node:diagnostics_channel';
81
118
  *
82
119
  * const channel = diagnostics_channel.channel('my-channel');
83
120
  *
@@ -88,19 +125,18 @@ declare module 'diagnostics_channel' {
88
125
  * @since v15.1.0, v14.17.0
89
126
  */
90
127
  readonly hasSubscribers: boolean;
91
- private constructor(name: string);
128
+ private constructor(name: string | symbol);
92
129
  /**
93
- * Publish a message to any subscribers to the channel. This will
94
- * trigger message handlers synchronously so they will execute within
95
- * the same context.
130
+ * Publish a message to any subscribers to the channel. This will trigger
131
+ * message handlers synchronously so they will execute within the same context.
96
132
  *
97
133
  * ```js
98
- * import diagnostics_channel from 'diagnostics_channel';
134
+ * import diagnostics_channel from 'node:diagnostics_channel';
99
135
  *
100
136
  * const channel = diagnostics_channel.channel('my-channel');
101
137
  *
102
138
  * channel.publish({
103
- * some: 'message'
139
+ * some: 'message',
104
140
  * });
105
141
  * ```
106
142
  * @since v15.1.0, v14.17.0
@@ -113,7 +149,7 @@ declare module 'diagnostics_channel' {
113
149
  * errors thrown in the message handler will trigger an `'uncaughtException'`.
114
150
  *
115
151
  * ```js
116
- * import diagnostics_channel from 'diagnostics_channel';
152
+ * import diagnostics_channel from 'node:diagnostics_channel';
117
153
  *
118
154
  * const channel = diagnostics_channel.channel('my-channel');
119
155
  *
@@ -122,6 +158,7 @@ declare module 'diagnostics_channel' {
122
158
  * });
123
159
  * ```
124
160
  * @since v15.1.0, v14.17.0
161
+ * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
125
162
  * @param onMessage The handler to receive channel messages
126
163
  */
127
164
  subscribe(onMessage: ChannelListener): void;
@@ -129,7 +166,7 @@ declare module 'diagnostics_channel' {
129
166
  * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
130
167
  *
131
168
  * ```js
132
- * import diagnostics_channel from 'diagnostics_channel';
169
+ * import diagnostics_channel from 'node:diagnostics_channel';
133
170
  *
134
171
  * const channel = diagnostics_channel.channel('my-channel');
135
172
  *
@@ -142,6 +179,7 @@ declare module 'diagnostics_channel' {
142
179
  * channel.unsubscribe(onMessage);
143
180
  * ```
144
181
  * @since v15.1.0, v14.17.0
182
+ * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
145
183
  * @param onMessage The previous subscribed handler to remove
146
184
  * @return `true` if the handler was found, `false` otherwise.
147
185
  */
node/dns/promises.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `dns.promises` API provides an alternative set of asynchronous DNS methods
3
3
  * that return `Promise` objects rather than using callbacks. The API is accessible
4
- * via `require('dns').promises` or `require('dns/promises')`.
4
+ * via `require('node:dns').promises` or `require('node:dns/promises')`.
5
5
  * @since v10.6.0
6
6
  */
7
7
  declare module 'dns/promises' {
@@ -52,7 +52,7 @@ declare module 'dns/promises' {
52
52
  *
53
53
  * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
54
54
  * protocol. The implementation uses an operating system facility that can
55
- * associate names with addresses, and vice versa. This implementation can have
55
+ * associate names with addresses and vice versa. This implementation can have
56
56
  * subtle but important consequences on the behavior of any Node.js program. Please
57
57
  * take some time to consult the `Implementation considerations section` before
58
58
  * using `dnsPromises.lookup()`.
@@ -60,7 +60,7 @@ declare module 'dns/promises' {
60
60
  * Example usage:
61
61
  *
62
62
  * ```js
63
- * const dns = require('dns');
63
+ * const dns = require('node:dns');
64
64
  * const dnsPromises = dns.promises;
65
65
  * const options = {
66
66
  * family: 6,
@@ -96,7 +96,7 @@ declare module 'dns/promises' {
96
96
  * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
97
97
  *
98
98
  * ```js
99
- * const dnsPromises = require('dns').promises;
99
+ * const dnsPromises = require('node:dns').promises;
100
100
  * dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
101
101
  * console.log(result.hostname, result.service);
102
102
  * // Prints: localhost ssh
@@ -206,7 +206,7 @@ declare module 'dns/promises' {
206
206
  */
207
207
  function resolveMx(hostname: string): Promise<MxRecord[]>;
208
208
  /**
209
- * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
209
+ * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
210
210
  * of objects with the following properties:
211
211
  *
212
212
  * * `flags`
@@ -337,13 +337,56 @@ declare module 'dns/promises' {
337
337
  * * `ipv4first`: sets default `verbatim` `false`.
338
338
  * * `verbatim`: sets default `verbatim` `true`.
339
339
  *
340
- * The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have
340
+ * The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have
341
341
  * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
342
342
  * default dns orders in workers.
343
343
  * @since v16.4.0, v14.18.0
344
344
  * @param order must be `'ipv4first'` or `'verbatim'`.
345
345
  */
346
346
  function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
347
+ /**
348
+ * An independent resolver for DNS requests.
349
+ *
350
+ * Creating a new resolver uses the default server settings. Setting
351
+ * the servers used for a resolver using `resolver.setServers()` does not affect
352
+ * other resolvers:
353
+ *
354
+ * ```js
355
+ * const { Resolver } = require('node:dns').promises;
356
+ * const resolver = new Resolver();
357
+ * resolver.setServers(['4.4.4.4']);
358
+ *
359
+ * // This request will use the server at 4.4.4.4, independent of global settings.
360
+ * resolver.resolve4('example.org').then((addresses) => {
361
+ * // ...
362
+ * });
363
+ *
364
+ * // Alternatively, the same code can be written using async-await style.
365
+ * (async function() {
366
+ * const addresses = await resolver.resolve4('example.org');
367
+ * })();
368
+ * ```
369
+ *
370
+ * The following methods from the `dnsPromises` API are available:
371
+ *
372
+ * * `resolver.getServers()`
373
+ * * `resolver.resolve()`
374
+ * * `resolver.resolve4()`
375
+ * * `resolver.resolve6()`
376
+ * * `resolver.resolveAny()`
377
+ * * `resolver.resolveCaa()`
378
+ * * `resolver.resolveCname()`
379
+ * * `resolver.resolveMx()`
380
+ * * `resolver.resolveNaptr()`
381
+ * * `resolver.resolveNs()`
382
+ * * `resolver.resolvePtr()`
383
+ * * `resolver.resolveSoa()`
384
+ * * `resolver.resolveSrv()`
385
+ * * `resolver.resolveTxt()`
386
+ * * `resolver.reverse()`
387
+ * * `resolver.setServers()`
388
+ * @since v10.6.0
389
+ */
347
390
  class Resolver {
348
391
  constructor(options?: ResolverOptions);
349
392
  cancel(): void;
@@ -352,6 +395,7 @@ declare module 'dns/promises' {
352
395
  resolve4: typeof resolve4;
353
396
  resolve6: typeof resolve6;
354
397
  resolveAny: typeof resolveAny;
398
+ resolveCaa: typeof resolveCaa;
355
399
  resolveCname: typeof resolveCname;
356
400
  resolveMx: typeof resolveMx;
357
401
  resolveNaptr: typeof resolveNaptr;
node/dns.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `dns` module enables name resolution. For example, use it to look up IP
2
+ * The `node:dns` module enables name resolution. For example, use it to look up IP
3
3
  * addresses of host names.
4
4
  *
5
5
  * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
@@ -9,7 +9,7 @@
9
9
  * system do, use {@link lookup}.
10
10
  *
11
11
  * ```js
12
- * const dns = require('dns');
12
+ * const dns = require('node:dns');
13
13
  *
14
14
  * dns.lookup('example.org', (err, address, family) => {
15
15
  * console.log('address: %j family: IPv%s', address, family);
@@ -17,13 +17,13 @@
17
17
  * // address: "93.184.216.34" family: IPv4
18
18
  * ```
19
19
  *
20
- * All other functions in the `dns` module connect to an actual DNS server to
20
+ * All other functions in the `node:dns` module connect to an actual DNS server to
21
21
  * perform name resolution. They will always use the network to perform DNS
22
22
  * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
23
23
  * DNS queries, bypassing other name-resolution facilities.
24
24
  *
25
25
  * ```js
26
- * const dns = require('dns');
26
+ * const dns = require('node:dns');
27
27
  *
28
28
  * dns.resolve4('archive.org', (err, addresses) => {
29
29
  * if (err) throw err;
@@ -42,7 +42,7 @@
42
42
  * ```
43
43
  *
44
44
  * See the `Implementation considerations section` for more information.
45
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
45
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js)
46
46
  */
47
47
  declare module 'dns' {
48
48
  import * as dnsPromises from 'node:dns/promises';
@@ -76,8 +76,8 @@ declare module 'dns' {
76
76
  /**
77
77
  * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
78
78
  * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
79
- * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
80
- * and IPv6 addresses are both returned if found.
79
+ * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
80
+ * IPv4 and IPv6 addresses are both returned if found.
81
81
  *
82
82
  * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
83
83
  * properties `address` and `family`.
@@ -89,14 +89,14 @@ declare module 'dns' {
89
89
  *
90
90
  * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
91
91
  * The implementation uses an operating system facility that can associate names
92
- * with addresses, and vice versa. This implementation can have subtle but
92
+ * with addresses and vice versa. This implementation can have subtle but
93
93
  * important consequences on the behavior of any Node.js program. Please take some
94
94
  * time to consult the `Implementation considerations section` before using`dns.lookup()`.
95
95
  *
96
96
  * Example usage:
97
97
  *
98
98
  * ```js
99
- * const dns = require('dns');
99
+ * const dns = require('node:dns');
100
100
  * const options = {
101
101
  * family: 6,
102
102
  * hints: dns.ADDRCONFIG | dns.V4MAPPED,
@@ -135,7 +135,7 @@ declare module 'dns' {
135
135
  * On an error, `err` is an `Error` object, where `err.code` is the error code.
136
136
  *
137
137
  * ```js
138
- * const dns = require('dns');
138
+ * const dns = require('node:dns');
139
139
  * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
140
140
  * console.log(hostname, service);
141
141
  * // Prints: localhost ssh
@@ -174,7 +174,7 @@ declare module 'dns' {
174
174
  type: 'AAAA';
175
175
  }
176
176
  export interface CaaRecord {
177
- critial: number;
177
+ critical: number;
178
178
  issue?: string | undefined;
179
179
  issuewild?: string | undefined;
180
180
  iodef?: string | undefined;
@@ -291,7 +291,7 @@ declare module 'dns' {
291
291
  function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
292
292
  }
293
293
  /**
294
- * Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
294
+ * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
295
295
  * will contain an array of IPv6 addresses.
296
296
  * @since v0.1.16
297
297
  * @param hostname Host name to resolve.
@@ -333,7 +333,7 @@ declare module 'dns' {
333
333
  function __promisify__(hostname: string): Promise<MxRecord[]>;
334
334
  }
335
335
  /**
336
- * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
336
+ * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
337
337
  * objects with the following properties:
338
338
  *
339
339
  * * `flags`
@@ -484,6 +484,14 @@ declare module 'dns' {
484
484
  * @since v0.1.16
485
485
  */
486
486
  export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
487
+ /**
488
+ * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
489
+ *
490
+ * * `ipv4first`: for `verbatim` defaulting to `false`.
491
+ * * `verbatim`: for `verbatim` defaulting to `true`.
492
+ * @since v20.1.0
493
+ */
494
+ export function getDefaultResultOrder(): 'ipv4first' | 'verbatim';
487
495
  /**
488
496
  * Sets the IP address and port of servers to be used when performing DNS
489
497
  * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -535,7 +543,7 @@ declare module 'dns' {
535
543
  * * `ipv4first`: sets default `verbatim` `false`.
536
544
  * * `verbatim`: sets default `verbatim` `true`.
537
545
  *
538
- * The default is `ipv4first` and {@link setDefaultResultOrder} have higher
546
+ * The default is `verbatim` and {@link setDefaultResultOrder} have higher
539
547
  * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
540
548
  * dns orders in workers.
541
549
  * @since v16.4.0, v14.18.0
@@ -582,7 +590,7 @@ declare module 'dns' {
582
590
  * other resolvers:
583
591
  *
584
592
  * ```js
585
- * const { Resolver } = require('dns');
593
+ * const { Resolver } = require('node:dns');
586
594
  * const resolver = new Resolver();
587
595
  * resolver.setServers(['4.4.4.4']);
588
596
  *
@@ -592,7 +600,7 @@ declare module 'dns' {
592
600
  * });
593
601
  * ```
594
602
  *
595
- * The following methods from the `dns` module are available:
603
+ * The following methods from the `node:dns` module are available:
596
604
  *
597
605
  * * `resolver.getServers()`
598
606
  * * `resolver.resolve()`
@@ -625,6 +633,7 @@ declare module 'dns' {
625
633
  resolve4: typeof resolve4;
626
634
  resolve6: typeof resolve6;
627
635
  resolveAny: typeof resolveAny;
636
+ resolveCaa: typeof resolveCaa;
628
637
  resolveCname: typeof resolveCname;
629
638
  resolveMx: typeof resolveMx;
630
639
  resolveNaptr: typeof resolveNaptr;
@@ -639,7 +648,7 @@ declare module 'dns' {
639
648
  * This allows programs to specify outbound interfaces when used on multi-homed
640
649
  * systems.
641
650
  *
642
- * If a v4 or v6 address is not specified, it is set to the default, and the
651
+ * If a v4 or v6 address is not specified, it is set to the default and the
643
652
  * operating system will choose a local address automatically.
644
653
  *
645
654
  * The resolver will use the v4 local address when making requests to IPv4 DNS
node/domain.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
13
13
  * exit immediately with an error code.
14
14
  * @deprecated Since v1.4.2 - Deprecated
15
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
15
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js)
16
16
  */
17
17
  declare module 'domain' {
18
18
  import EventEmitter = require('node:events');
@@ -56,15 +56,15 @@ declare module 'domain' {
56
56
  exit(): void;
57
57
  /**
58
58
  * Run the supplied function in the context of the domain, implicitly
59
- * binding all event emitters, timers, and lowlevel requests that are
59
+ * binding all event emitters, timers, and low-level requests that are
60
60
  * created in that context. Optionally, arguments can be passed to
61
61
  * the function.
62
62
  *
63
63
  * This is the most basic way to use a domain.
64
64
  *
65
65
  * ```js
66
- * const domain = require('domain');
67
- * const fs = require('fs');
66
+ * const domain = require('node:domain');
67
+ * const fs = require('node:fs');
68
68
  * const d = domain.create();
69
69
  * d.on('error', (er) => {
70
70
  * console.error('Caught error!', er);