@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.1-alpha.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.
Files changed (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -4,9 +4,9 @@
4
4
  * it:
5
5
  *
6
6
  * ```js
7
- * const util = require('node:util');
7
+ * import util from 'node:util';
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/util.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/util.js)
10
10
  */
11
11
  declare module "util" {
12
12
  import * as types from "node:util/types";
@@ -108,9 +108,86 @@ declare module "util" {
108
108
  export interface InspectOptionsStylized extends InspectOptions {
109
109
  stylize(text: string, styleType: Style): string;
110
110
  }
111
+ export interface CallSiteObject {
112
+ /**
113
+ * Returns the name of the function associated with this call site.
114
+ */
115
+ functionName: string;
116
+ /**
117
+ * Returns the name of the resource that contains the script for the
118
+ * function for this call site.
119
+ */
120
+ scriptName: string;
121
+ /**
122
+ * Returns the unique id of the script, as in Chrome DevTools protocol
123
+ * [`Runtime.ScriptId`](https://chromedevtools.github.io/devtools-protocol/1-3/Runtime/#type-ScriptId).
124
+ * @since v22.14.0
125
+ */
126
+ scriptId: string;
127
+ /**
128
+ * Returns the number, 1-based, of the line for the associate function call.
129
+ */
130
+ lineNumber: number;
131
+ /**
132
+ * Returns the 1-based column offset on the line for the associated function call.
133
+ */
134
+ columnNumber: number;
135
+ }
136
+ export type DiffEntry = [operation: -1 | 0 | 1, value: string];
137
+ /**
138
+ * `util.diff()` compares two string or array values and returns an array of difference entries.
139
+ * It uses the Myers diff algorithm to compute minimal differences, which is the same algorithm
140
+ * used internally by assertion error messages.
141
+ *
142
+ * If the values are equal, an empty array is returned.
143
+ *
144
+ * ```js
145
+ * const { diff } = require('node:util');
146
+ *
147
+ * // Comparing strings
148
+ * const actualString = '12345678';
149
+ * const expectedString = '12!!5!7!';
150
+ * console.log(diff(actualString, expectedString));
151
+ * // [
152
+ * // [0, '1'],
153
+ * // [0, '2'],
154
+ * // [1, '3'],
155
+ * // [1, '4'],
156
+ * // [-1, '!'],
157
+ * // [-1, '!'],
158
+ * // [0, '5'],
159
+ * // [1, '6'],
160
+ * // [-1, '!'],
161
+ * // [0, '7'],
162
+ * // [1, '8'],
163
+ * // [-1, '!'],
164
+ * // ]
165
+ * // Comparing arrays
166
+ * const actualArray = ['1', '2', '3'];
167
+ * const expectedArray = ['1', '3', '4'];
168
+ * console.log(diff(actualArray, expectedArray));
169
+ * // [
170
+ * // [0, '1'],
171
+ * // [1, '2'],
172
+ * // [0, '3'],
173
+ * // [-1, '4'],
174
+ * // ]
175
+ * // Equal values return empty array
176
+ * console.log(diff('same', 'same'));
177
+ * // []
178
+ * ```
179
+ * @since v22.15.0
180
+ * @experimental
181
+ * @param actual The first value to compare
182
+ * @param expected The second value to compare
183
+ * @returns An array of difference entries. Each entry is an array with two elements:
184
+ * * Index 0: `number` Operation code: `-1` for delete, `0` for no-op/unchanged, `1` for insert
185
+ * * Index 1: `string` The value associated with the operation
186
+ */
187
+ export function diff(actual: string | readonly string[], expected: string | readonly string[]): DiffEntry[];
111
188
  /**
112
189
  * The `util.format()` method returns a formatted string using the first argument
113
- * as a `printf`\-like format string which can contain zero or more format
190
+ * as a `printf`-like format string which can contain zero or more format
114
191
  * specifiers. Each specifier is replaced with the converted value from the
115
192
  * corresponding argument. Supported specifiers are:
116
193
  *
@@ -121,7 +198,7 @@ declare module "util" {
121
198
  * // Returns: 'foo:%s'
122
199
  * ```
123
200
  *
124
- * Values that are not part of the format string are formatted using`util.inspect()` if their type is not `string`.
201
+ * Values that are not part of the format string are formatted using `util.inspect()` if their type is not `string`.
125
202
  *
126
203
  * If there are more arguments passed to the `util.format()` method than the
127
204
  * number of specifiers, the extra arguments are concatenated to the returned
@@ -132,7 +209,7 @@ declare module "util" {
132
209
  * // Returns: 'foo:bar baz'
133
210
  * ```
134
211
  *
135
- * If the first argument does not contain a valid format specifier, `util.format()`returns a string that is the concatenation of all arguments separated by spaces:
212
+ * If the first argument does not contain a valid format specifier, `util.format()` returns a string that is the concatenation of all arguments separated by spaces:
136
213
  *
137
214
  * ```js
138
215
  * util.format(1, 2, 3);
@@ -166,6 +243,90 @@ declare module "util" {
166
243
  * @since v10.0.0
167
244
  */
168
245
  export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
246
+ interface GetCallSitesOptions {
247
+ /**
248
+ * Reconstruct the original location in the stacktrace from the source-map.
249
+ * Enabled by default with the flag `--enable-source-maps`.
250
+ */
251
+ sourceMap?: boolean | undefined;
252
+ }
253
+ /**
254
+ * Returns an array of call site objects containing the stack of
255
+ * the caller function.
256
+ *
257
+ * Unlike accessing an `error.stack`, the result returned from this API is not
258
+ * interfered with `Error.prepareStackTrace`.
259
+ *
260
+ * ```js
261
+ * import { getCallSites } from 'node:util';
262
+ *
263
+ * function exampleFunction() {
264
+ * const callSites = getCallSites();
265
+ *
266
+ * console.log('Call Sites:');
267
+ * callSites.forEach((callSite, index) => {
268
+ * console.log(`CallSite ${index + 1}:`);
269
+ * console.log(`Function Name: ${callSite.functionName}`);
270
+ * console.log(`Script Name: ${callSite.scriptName}`);
271
+ * console.log(`Line Number: ${callSite.lineNumber}`);
272
+ * console.log(`Column Number: ${callSite.columnNumber}`);
273
+ * });
274
+ * // CallSite 1:
275
+ * // Function Name: exampleFunction
276
+ * // Script Name: /home/example.js
277
+ * // Line Number: 5
278
+ * // Column Number: 26
279
+ *
280
+ * // CallSite 2:
281
+ * // Function Name: anotherFunction
282
+ * // Script Name: /home/example.js
283
+ * // Line Number: 22
284
+ * // Column Number: 3
285
+ *
286
+ * // ...
287
+ * }
288
+ *
289
+ * // A function to simulate another stack layer
290
+ * function anotherFunction() {
291
+ * exampleFunction();
292
+ * }
293
+ *
294
+ * anotherFunction();
295
+ * ```
296
+ *
297
+ * It is possible to reconstruct the original locations by setting the option `sourceMap` to `true`.
298
+ * If the source map is not available, the original location will be the same as the current location.
299
+ * When the `--enable-source-maps` flag is enabled, for example when using `--experimental-transform-types`,
300
+ * `sourceMap` will be true by default.
301
+ *
302
+ * ```ts
303
+ * import { getCallSites } from 'node:util';
304
+ *
305
+ * interface Foo {
306
+ * foo: string;
307
+ * }
308
+ *
309
+ * const callSites = getCallSites({ sourceMap: true });
310
+ *
311
+ * // With sourceMap:
312
+ * // Function Name: ''
313
+ * // Script Name: example.js
314
+ * // Line Number: 7
315
+ * // Column Number: 26
316
+ *
317
+ * // Without sourceMap:
318
+ * // Function Name: ''
319
+ * // Script Name: example.js
320
+ * // Line Number: 2
321
+ * // Column Number: 26
322
+ * ```
323
+ * @param frameCount Number of frames to capture as call site objects.
324
+ * **Default:** `10`. Allowable range is between 1 and 200.
325
+ * @return An array of call site objects
326
+ * @since v22.9.0
327
+ */
328
+ export function getCallSites(frameCount?: number, options?: GetCallSitesOptions): CallSiteObject[];
329
+ export function getCallSites(options: GetCallSitesOptions): CallSiteObject[];
169
330
  /**
170
331
  * Returns the string name for a numeric error code that comes from a Node.js API.
171
332
  * The mapping between error codes and error names is platform-dependent.
@@ -180,6 +341,11 @@ declare module "util" {
180
341
  * @since v9.7.0
181
342
  */
182
343
  export function getSystemErrorName(err: number): string;
344
+ /**
345
+ * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.
346
+ * @since 24.6.0
347
+ */
348
+ export function setTraceSigInt(enable: boolean): void;
183
349
  /**
184
350
  * Returns a Map of all system error codes available from the Node.js API.
185
351
  * The mapping between error codes and error names is platform-dependent.
@@ -196,18 +362,19 @@ declare module "util" {
196
362
  */
197
363
  export function getSystemErrorMap(): Map<number, [string, string]>;
198
364
  /**
199
- * The `util.log()` method prints the given `string` to `stdout` with an included
200
- * timestamp.
365
+ * Returns the string message for a numeric error code that comes from a Node.js
366
+ * API.
367
+ * The mapping between error codes and string messages is platform-dependent.
201
368
  *
202
369
  * ```js
203
- * const util = require('node:util');
204
- *
205
- * util.log('Timestamped message.');
370
+ * fs.access('file/that/does/not/exist', (err) => {
371
+ * const message = util.getSystemErrorMessage(err.errno);
372
+ * console.error(message); // no such file or directory
373
+ * });
206
374
  * ```
207
- * @since v0.3.0
208
- * @deprecated Since v6.0.0 - Use a third party module instead.
375
+ * @since v22.12.0
209
376
  */
210
- export function log(string: string): void;
377
+ export function getSystemErrorMessage(err: number): string;
211
378
  /**
212
379
  * Returns the `string` after replacing any surrogate code points
213
380
  * (or equivalently, any unpaired surrogate code units) with the
@@ -219,7 +386,6 @@ declare module "util" {
219
386
  * Creates and returns an `AbortController` instance whose `AbortSignal` is marked
220
387
  * as transferable and can be used with `structuredClone()` or `postMessage()`.
221
388
  * @since v18.11.0
222
- * @experimental
223
389
  * @returns A transferable AbortController
224
390
  */
225
391
  export function transferableAbortController(): AbortController;
@@ -232,41 +398,49 @@ declare module "util" {
232
398
  * channel.port2.postMessage(signal, [signal]);
233
399
  * ```
234
400
  * @since v18.11.0
235
- * @experimental
236
401
  * @param signal The AbortSignal
237
402
  * @returns The same AbortSignal
238
403
  */
239
404
  export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
240
405
  /**
241
- * Listens to abort event on the provided `signal` and
242
- * returns a promise that is fulfilled when the `signal` is
243
- * aborted. If the passed `resource` is garbage collected before the `signal` is
244
- * aborted, the returned promise shall remain pending indefinitely.
406
+ * Listens to abort event on the provided `signal` and returns a promise that resolves when the `signal` is aborted.
407
+ * If `resource` is provided, it weakly references the operation's associated object,
408
+ * so if `resource` is garbage collected before the `signal` aborts,
409
+ * then returned promise shall remain pending.
410
+ * This prevents memory leaks in long-running or non-cancelable operations.
245
411
  *
246
412
  * ```js
247
413
  * import { aborted } from 'node:util';
248
414
  *
415
+ * // Obtain an object with an abortable signal, like a custom resource or operation.
249
416
  * const dependent = obtainSomethingAbortable();
250
417
  *
418
+ * // Pass `dependent` as the resource, indicating the promise should only resolve
419
+ * // if `dependent` is still in memory when the signal is aborted.
251
420
  * aborted(dependent.signal, dependent).then(() => {
252
- * // Do something when dependent is aborted.
421
+ * // This code runs when `dependent` is aborted.
422
+ * console.log('Dependent resource was aborted.');
253
423
  * });
254
424
  *
425
+ * // Simulate an event that triggers the abort.
255
426
  * dependent.on('event', () => {
256
- * dependent.abort();
427
+ * dependent.abort(); // This will cause the `aborted` promise to resolve.
257
428
  * });
258
429
  * ```
259
430
  * @since v19.7.0
260
- * @experimental
261
- * @param resource Any non-null entity, reference to which is held weakly.
431
+ * @param resource Any non-null object tied to the abortable operation and held weakly.
432
+ * If `resource` is garbage collected before the `signal` aborts, the promise remains pending,
433
+ * allowing Node.js to stop tracking it.
434
+ * This helps prevent memory leaks in long-running or non-cancelable operations.
262
435
  */
263
436
  export function aborted(signal: AbortSignal, resource: any): Promise<void>;
264
437
  /**
265
438
  * The `util.inspect()` method returns a string representation of `object` that is
266
439
  * intended for debugging. The output of `util.inspect` may change at any time
267
440
  * and should not be depended upon programmatically. Additional `options` may be
268
- * passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make
269
- * an identifiable tag for an inspected value.
441
+ * passed that alter the result.
442
+ * `util.inspect()` will use the constructor's name and/or `Symbol.toStringTag`
443
+ * property to make an identifiable tag for an inspected value.
270
444
  *
271
445
  * ```js
272
446
  * class Foo {
@@ -287,7 +461,7 @@ declare module "util" {
287
461
  * Circular references point to their anchor by using a reference index:
288
462
  *
289
463
  * ```js
290
- * const { inspect } = require('node:util');
464
+ * import { inspect } from 'node:util';
291
465
  *
292
466
  * const obj = {};
293
467
  * obj.a = [obj];
@@ -305,7 +479,7 @@ declare module "util" {
305
479
  * The following example inspects all properties of the `util` object:
306
480
  *
307
481
  * ```js
308
- * const util = require('node:util');
482
+ * import util from 'node:util';
309
483
  *
310
484
  * console.log(util.inspect(util, { showHidden: true, depth: null }));
311
485
  * ```
@@ -313,7 +487,7 @@ declare module "util" {
313
487
  * The following example highlights the effect of the `compact` option:
314
488
  *
315
489
  * ```js
316
- * const util = require('node:util');
490
+ * import { inspect } from 'node:util';
317
491
  *
318
492
  * const o = {
319
493
  * a: [1, 2, [[
@@ -323,7 +497,7 @@ declare module "util" {
323
497
  * 'foo']], 4],
324
498
  * b: new Map([['za', 1], ['zb', 'test']]),
325
499
  * };
326
- * console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
500
+ * console.log(inspect(o, { compact: true, depth: 5, breakLength: 80 }));
327
501
  *
328
502
  * // { a:
329
503
  * // [ 1,
@@ -335,7 +509,7 @@ declare module "util" {
335
509
  * // b: Map(2) { 'za' => 1, 'zb' => 'test' } }
336
510
  *
337
511
  * // Setting `compact` to false or an integer creates more reader friendly output.
338
- * console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
512
+ * console.log(inspect(o, { compact: false, depth: 5, breakLength: 80 }));
339
513
  *
340
514
  * // {
341
515
  * // a: [
@@ -362,15 +536,14 @@ declare module "util" {
362
536
  * // single line.
363
537
  * ```
364
538
  *
365
- * The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
366
- * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be
539
+ * The `showHidden` option allows `WeakMap` and `WeakSet` entries to be
367
540
  * inspected. If there are more entries than `maxArrayLength`, there is no
368
- * guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
369
- * result in different output. Furthermore, entries
541
+ * guarantee which entries are displayed. That means retrieving the same
542
+ * `WeakSet` entries twice may result in different output. Furthermore, entries
370
543
  * with no remaining strong references may be garbage collected at any time.
371
544
  *
372
545
  * ```js
373
- * const { inspect } = require('node:util');
546
+ * import { inspect } from 'node:util';
374
547
  *
375
548
  * const obj = { a: 1 };
376
549
  * const obj2 = { b: 2 };
@@ -384,8 +557,8 @@ declare module "util" {
384
557
  * impact the result of `util.inspect()`.
385
558
  *
386
559
  * ```js
387
- * const { inspect } = require('node:util');
388
- * const assert = require('node:assert');
560
+ * import { inspect } from 'node:util';
561
+ * import assert from 'node:assert';
389
562
  *
390
563
  * const o1 = {
391
564
  * b: [2, 3, 1],
@@ -412,12 +585,12 @@ declare module "util" {
412
585
  * numbers.
413
586
  *
414
587
  * ```js
415
- * const { inspect } = require('node:util');
588
+ * import { inspect } from 'node:util';
416
589
  *
417
- * const thousand = 1_000;
418
- * const million = 1_000_000;
419
- * const bigNumber = 123_456_789n;
420
- * const bigDecimal = 1_234.123_45;
590
+ * const thousand = 1000;
591
+ * const million = 1000000;
592
+ * const bigNumber = 123456789n;
593
+ * const bigDecimal = 1234.12345;
421
594
  *
422
595
  * console.log(inspect(thousand, { numericSeparator: true }));
423
596
  * // 1_000
@@ -459,7 +632,7 @@ declare module "util" {
459
632
  * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
460
633
  *
461
634
  * ```js
462
- * const util = require('node:util');
635
+ * import util from 'node:util';
463
636
  *
464
637
  * util.isArray([]);
465
638
  * // Returns: true
@@ -473,78 +646,17 @@ declare module "util" {
473
646
  */
474
647
  export function isArray(object: unknown): object is unknown[];
475
648
  /**
476
- * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
477
- *
478
- * ```js
479
- * const util = require('node:util');
480
- *
481
- * util.isRegExp(/some regexp/);
482
- * // Returns: true
483
- * util.isRegExp(new RegExp('another regexp'));
484
- * // Returns: true
485
- * util.isRegExp({});
486
- * // Returns: false
487
- * ```
488
- * @since v0.6.0
489
- * @deprecated Since v4.0.0 - Deprecated
490
- */
491
- export function isRegExp(object: unknown): object is RegExp;
492
- /**
493
- * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
494
- *
495
- * ```js
496
- * const util = require('node:util');
497
- *
498
- * util.isDate(new Date());
499
- * // Returns: true
500
- * util.isDate(Date());
501
- * // false (without 'new' returns a String)
502
- * util.isDate({});
503
- * // Returns: false
504
- * ```
505
- * @since v0.6.0
506
- * @deprecated Since v4.0.0 - Use {@link types.isDate} instead.
507
- */
508
- export function isDate(object: unknown): object is Date;
509
- /**
510
- * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
511
- *
512
- * ```js
513
- * const util = require('node:util');
514
- *
515
- * util.isError(new Error());
516
- * // Returns: true
517
- * util.isError(new TypeError());
518
- * // Returns: true
519
- * util.isError({ name: 'Error', message: 'an error occurred' });
520
- * // Returns: false
521
- * ```
522
- *
523
- * This method relies on `Object.prototype.toString()` behavior. It is
524
- * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
525
- *
526
- * ```js
527
- * const util = require('node:util');
528
- * const obj = { name: 'Error', message: 'an error occurred' };
529
- *
530
- * util.isError(obj);
531
- * // Returns: false
532
- * obj[Symbol.toStringTag] = 'Error';
533
- * util.isError(obj);
534
- * // Returns: true
535
- * ```
536
- * @since v0.6.0
537
- * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead.
538
- */
539
- export function isError(object: unknown): object is Error;
540
- /**
541
- * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note
649
+ * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and
650
+ * `extends` keywords to get language level inheritance support. Also note
542
651
  * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179).
543
652
  *
544
- * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The
545
- * prototype of `constructor` will be set to a new object created from`superConstructor`.
653
+ * Inherit the prototype methods from one
654
+ * [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The
655
+ * prototype of `constructor` will be set to a new object created from
656
+ * `superConstructor`.
546
657
  *
547
- * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.
658
+ * This mainly adds some input validation on top of
659
+ * `Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.
548
660
  * As an additional convenience, `superConstructor` will be accessible
549
661
  * through the `constructor.super_` property.
550
662
  *
@@ -576,7 +688,7 @@ declare module "util" {
576
688
  * ES6 example using `class` and `extends`:
577
689
  *
578
690
  * ```js
579
- * const EventEmitter = require('node:events');
691
+ * import EventEmitter from 'node:events';
580
692
  *
581
693
  * class MyStream extends EventEmitter {
582
694
  * write(data) {
@@ -597,18 +709,42 @@ declare module "util" {
597
709
  export function inherits(constructor: unknown, superConstructor: unknown): void;
598
710
  export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
599
711
  export interface DebugLogger extends DebugLoggerFunction {
712
+ /**
713
+ * The `util.debuglog().enabled` getter is used to create a test that can be used
714
+ * in conditionals based on the existence of the `NODE_DEBUG` environment variable.
715
+ * If the `section` name appears within the value of that environment variable,
716
+ * then the returned value will be `true`. If not, then the returned value will be
717
+ * `false`.
718
+ *
719
+ * ```js
720
+ * import { debuglog } from 'node:util';
721
+ * const enabled = debuglog('foo').enabled;
722
+ * if (enabled) {
723
+ * console.log('hello from foo [%d]', 123);
724
+ * }
725
+ * ```
726
+ *
727
+ * If this program is run with `NODE_DEBUG=foo` in the environment, then it will
728
+ * output something like:
729
+ *
730
+ * ```console
731
+ * hello from foo [123]
732
+ * ```
733
+ */
600
734
  enabled: boolean;
601
735
  }
602
736
  /**
603
737
  * The `util.debuglog()` method is used to create a function that conditionally
604
- * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`environment variable. If the `section` name appears within the value of that
605
- * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
738
+ * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`
739
+ * environment variable. If the `section` name appears within the value of that
740
+ * environment variable, then the returned function operates similar to
741
+ * `console.error()`. If not, then the returned function is a no-op.
606
742
  *
607
743
  * ```js
608
- * const util = require('node:util');
609
- * const debuglog = util.debuglog('foo');
744
+ * import { debuglog } from 'node:util';
745
+ * const log = debuglog('foo');
610
746
  *
611
- * debuglog('hello from foo [%d]', 123);
747
+ * log('hello from foo [%d]', 123);
612
748
  * ```
613
749
  *
614
750
  * If this program is run with `NODE_DEBUG=foo` in the environment, then
@@ -624,10 +760,10 @@ declare module "util" {
624
760
  * The `section` supports wildcard also:
625
761
  *
626
762
  * ```js
627
- * const util = require('node:util');
628
- * const debuglog = util.debuglog('foo-bar');
763
+ * import { debuglog } from 'node:util';
764
+ * const log = debuglog('foo-bar');
629
765
  *
630
- * debuglog('hi there, it\'s foo-bar [%d]', 2333);
766
+ * log('hi there, it\'s foo-bar [%d]', 2333);
631
767
  * ```
632
768
  *
633
769
  * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
@@ -637,18 +773,19 @@ declare module "util" {
637
773
  * FOO-BAR 3257: hi there, it's foo-bar [2333]
638
774
  * ```
639
775
  *
640
- * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`.
776
+ * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`
777
+ * environment variable: `NODE_DEBUG=fs,net,tls`.
641
778
  *
642
779
  * The optional `callback` argument can be used to replace the logging function
643
780
  * with a different function that doesn't have any initialization or
644
781
  * unnecessary wrapping.
645
782
  *
646
783
  * ```js
647
- * const util = require('node:util');
648
- * let debuglog = util.debuglog('internals', (debug) => {
784
+ * import { debuglog } from 'node:util';
785
+ * let log = debuglog('internals', (debug) => {
649
786
  * // Replace with a logging function that optimizes out
650
787
  * // testing if the section is enabled
651
- * debuglog = debug;
788
+ * log = debug;
652
789
  * });
653
790
  * ```
654
791
  * @since v0.11.3
@@ -657,231 +794,29 @@ declare module "util" {
657
794
  * @return The logging function
658
795
  */
659
796
  export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
660
- export const debug: typeof debuglog;
661
- /**
662
- * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
663
- *
664
- * ```js
665
- * const util = require('node:util');
666
- *
667
- * util.isBoolean(1);
668
- * // Returns: false
669
- * util.isBoolean(0);
670
- * // Returns: false
671
- * util.isBoolean(false);
672
- * // Returns: true
673
- * ```
674
- * @since v0.11.5
675
- * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead.
676
- */
677
- export function isBoolean(object: unknown): object is boolean;
678
- /**
679
- * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
680
- *
681
- * ```js
682
- * const util = require('node:util');
683
- *
684
- * util.isBuffer({ length: 0 });
685
- * // Returns: false
686
- * util.isBuffer([]);
687
- * // Returns: false
688
- * util.isBuffer(Buffer.from('hello world'));
689
- * // Returns: true
690
- * ```
691
- * @since v0.11.5
692
- * @deprecated Since v4.0.0 - Use `isBuffer` instead.
693
- */
694
- export function isBuffer(object: unknown): object is Buffer;
695
- /**
696
- * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
697
- *
698
- * ```js
699
- * const util = require('node:util');
700
- *
701
- * function Foo() {}
702
- * const Bar = () => {};
703
- *
704
- * util.isFunction({});
705
- * // Returns: false
706
- * util.isFunction(Foo);
707
- * // Returns: true
708
- * util.isFunction(Bar);
709
- * // Returns: true
710
- * ```
711
- * @since v0.11.5
712
- * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead.
713
- */
714
- export function isFunction(object: unknown): boolean;
715
- /**
716
- * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
717
- *
718
- * ```js
719
- * const util = require('node:util');
720
- *
721
- * util.isNull(0);
722
- * // Returns: false
723
- * util.isNull(undefined);
724
- * // Returns: false
725
- * util.isNull(null);
726
- * // Returns: true
727
- * ```
728
- * @since v0.11.5
729
- * @deprecated Since v4.0.0 - Use `value === null` instead.
730
- */
731
- export function isNull(object: unknown): object is null;
732
- /**
733
- * Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
734
- * returns `false`.
735
- *
736
- * ```js
737
- * const util = require('node:util');
738
- *
739
- * util.isNullOrUndefined(0);
740
- * // Returns: false
741
- * util.isNullOrUndefined(undefined);
742
- * // Returns: true
743
- * util.isNullOrUndefined(null);
744
- * // Returns: true
745
- * ```
746
- * @since v0.11.5
747
- * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
748
- */
749
- export function isNullOrUndefined(object: unknown): object is null | undefined;
750
- /**
751
- * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
752
- *
753
- * ```js
754
- * const util = require('node:util');
755
- *
756
- * util.isNumber(false);
757
- * // Returns: false
758
- * util.isNumber(Infinity);
759
- * // Returns: true
760
- * util.isNumber(0);
761
- * // Returns: true
762
- * util.isNumber(NaN);
763
- * // Returns: true
764
- * ```
765
- * @since v0.11.5
766
- * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead.
767
- */
768
- export function isNumber(object: unknown): object is number;
769
- /**
770
- * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript).
771
- * Otherwise, returns `false`.
772
- *
773
- * ```js
774
- * const util = require('node:util');
775
- *
776
- * util.isObject(5);
777
- * // Returns: false
778
- * util.isObject(null);
779
- * // Returns: false
780
- * util.isObject({});
781
- * // Returns: true
782
- * util.isObject(() => {});
783
- * // Returns: false
784
- * ```
785
- * @since v0.11.5
786
- * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead.
787
- */
788
- export function isObject(object: unknown): boolean;
789
- /**
790
- * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
791
- *
792
- * ```js
793
- * const util = require('node:util');
794
- *
795
- * util.isPrimitive(5);
796
- * // Returns: true
797
- * util.isPrimitive('foo');
798
- * // Returns: true
799
- * util.isPrimitive(false);
800
- * // Returns: true
801
- * util.isPrimitive(null);
802
- * // Returns: true
803
- * util.isPrimitive(undefined);
804
- * // Returns: true
805
- * util.isPrimitive({});
806
- * // Returns: false
807
- * util.isPrimitive(() => {});
808
- * // Returns: false
809
- * util.isPrimitive(/^$/);
810
- * // Returns: false
811
- * util.isPrimitive(new Date());
812
- * // Returns: false
813
- * ```
814
- * @since v0.11.5
815
- * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead.
816
- */
817
- export function isPrimitive(object: unknown): boolean;
818
- /**
819
- * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
820
- *
821
- * ```js
822
- * const util = require('node:util');
823
- *
824
- * util.isString('');
825
- * // Returns: true
826
- * util.isString('foo');
827
- * // Returns: true
828
- * util.isString(String('foo'));
829
- * // Returns: true
830
- * util.isString(5);
831
- * // Returns: false
832
- * ```
833
- * @since v0.11.5
834
- * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead.
835
- */
836
- export function isString(object: unknown): object is string;
837
- /**
838
- * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
839
- *
840
- * ```js
841
- * const util = require('node:util');
842
- *
843
- * util.isSymbol(5);
844
- * // Returns: false
845
- * util.isSymbol('foo');
846
- * // Returns: false
847
- * util.isSymbol(Symbol('foo'));
848
- * // Returns: true
849
- * ```
850
- * @since v0.11.5
851
- * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead.
852
- */
853
- export function isSymbol(object: unknown): object is symbol;
854
- /**
855
- * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
856
- *
857
- * ```js
858
- * const util = require('node:util');
859
- *
860
- * const foo = undefined;
861
- * util.isUndefined(5);
862
- * // Returns: false
863
- * util.isUndefined(foo);
864
- * // Returns: true
865
- * util.isUndefined(null);
866
- * // Returns: false
867
- * ```
868
- * @since v0.11.5
869
- * @deprecated Since v4.0.0 - Use `value === undefined` instead.
870
- */
871
- export function isUndefined(object: unknown): object is undefined;
797
+ export { debuglog as debug };
798
+ export interface DeprecateOptions {
799
+ /**
800
+ * When false do not change the prototype of object while emitting the deprecation warning.
801
+ * @since v24.12.0
802
+ * @default true
803
+ */
804
+ modifyPrototype?: boolean | undefined;
805
+ }
872
806
  /**
873
807
  * The `util.deprecate()` method wraps `fn` (which may be a function or class) in
874
808
  * such a way that it is marked as deprecated.
875
809
  *
876
810
  * ```js
877
- * const util = require('node:util');
811
+ * import { deprecate } from 'node:util';
878
812
  *
879
- * exports.obsoleteFunction = util.deprecate(() => {
813
+ * export const obsoleteFunction = deprecate(() => {
880
814
  * // Do something here.
881
815
  * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');
882
816
  * ```
883
817
  *
884
- * When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will
818
+ * When called, `util.deprecate()` will return a function that will emit a
819
+ * `DeprecationWarning` using the `'warning'` event. The warning will
885
820
  * be emitted and printed to `stderr` the first time the returned function is
886
821
  * called. After the warning is emitted, the wrapped function is called without
887
822
  * emitting a warning.
@@ -890,16 +825,24 @@ declare module "util" {
890
825
  * the warning will be emitted only once for that `code`.
891
826
  *
892
827
  * ```js
893
- * const util = require('node:util');
828
+ * import { deprecate } from 'node:util';
894
829
  *
895
- * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
896
- * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
830
+ * const fn1 = deprecate(
831
+ * () => 'a value',
832
+ * 'deprecation message',
833
+ * 'DEP0001',
834
+ * );
835
+ * const fn2 = deprecate(
836
+ * () => 'a different value',
837
+ * 'other dep message',
838
+ * 'DEP0001',
839
+ * );
897
840
  * fn1(); // Emits a deprecation warning with code DEP0001
898
841
  * fn2(); // Does not emit a deprecation warning because it has the same code
899
842
  * ```
900
843
  *
901
844
  * If either the `--no-deprecation` or `--no-warnings` command-line flags are
902
- * used, or if the `process.noDeprecation` property is set to `true`_prior_ to
845
+ * used, or if the `process.noDeprecation` property is set to `true` _prior_ to
903
846
  * the first deprecation warning, the `util.deprecate()` method does nothing.
904
847
  *
905
848
  * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set,
@@ -907,17 +850,29 @@ declare module "util" {
907
850
  * stack trace are printed to `stderr` the first time the deprecated function is
908
851
  * called.
909
852
  *
910
- * If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be
853
+ * If the `--throw-deprecation` command-line flag is set, or the
854
+ * `process.throwDeprecation` property is set to `true`, then an exception will be
911
855
  * thrown when the deprecated function is called.
912
856
  *
913
- * The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`.
857
+ * The `--throw-deprecation` command-line flag and `process.throwDeprecation`
858
+ * property take precedence over `--trace-deprecation` and
859
+ * `process.traceDeprecation`.
914
860
  * @since v0.8.0
915
861
  * @param fn The function that is being deprecated.
916
862
  * @param msg A warning message to display when the deprecated function is invoked.
917
863
  * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
918
864
  * @return The deprecated function wrapped to emit a warning.
919
865
  */
920
- export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
866
+ export function deprecate<T extends Function>(fn: T, msg: string, code?: string, options?: DeprecateOptions): T;
867
+ export interface IsDeepStrictEqualOptions {
868
+ /**
869
+ * If `true`, prototype and constructor
870
+ * comparison is skipped during deep strict equality check.
871
+ * @since v24.9.0
872
+ * @default false
873
+ */
874
+ skipPrototype?: boolean | undefined;
875
+ }
921
876
  /**
922
877
  * Returns `true` if there is deep strict equality between `val1` and `val2`.
923
878
  * Otherwise, returns `false`.
@@ -926,7 +881,7 @@ declare module "util" {
926
881
  * equality.
927
882
  * @since v9.0.0
928
883
  */
929
- export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
884
+ export function isDeepStrictEqual(val1: unknown, val2: unknown, options?: IsDeepStrictEqualOptions): boolean;
930
885
  /**
931
886
  * Returns `str` with any ANSI escape codes removed.
932
887
  *
@@ -941,15 +896,16 @@ declare module "util" {
941
896
  * Takes an `async` function (or a function that returns a `Promise`) and returns a
942
897
  * function following the error-first callback style, i.e. taking
943
898
  * an `(err, value) => ...` callback as the last argument. In the callback, the
944
- * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
899
+ * first argument will be the rejection reason (or `null` if the `Promise`
900
+ * resolved), and the second argument will be the resolved value.
945
901
  *
946
902
  * ```js
947
- * const util = require('node:util');
903
+ * import { callbackify } from 'node:util';
948
904
  *
949
905
  * async function fn() {
950
906
  * return 'hello world';
951
907
  * }
952
- * const callbackFunction = util.callbackify(fn);
908
+ * const callbackFunction = callbackify(fn);
953
909
  *
954
910
  * callbackFunction((err, ret) => {
955
911
  * if (err) throw err;
@@ -964,11 +920,13 @@ declare module "util" {
964
920
  * ```
965
921
  *
966
922
  * The callback is executed asynchronously, and will have a limited stack trace.
967
- * If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit.
923
+ * If the callback throws, the process will emit an `'uncaughtException'`
924
+ * event, and if not handled will exit.
968
925
  *
969
926
  * Since `null` has a special meaning as the first argument to a callback, if a
970
927
  * wrapped function rejects a `Promise` with a falsy value as a reason, the value
971
- * is wrapped in an `Error` with the original value stored in a field named`reason`.
928
+ * is wrapped in an `Error` with the original value stored in a field named
929
+ * `reason`.
972
930
  *
973
931
  * ```js
974
932
  * function fn() {
@@ -979,7 +937,7 @@ declare module "util" {
979
937
  * callbackFunction((err, ret) => {
980
938
  * // When the Promise was rejected with `null` it is wrapped with an Error and
981
939
  * // the original value is stored in `reason`.
982
- * err &#x26;&#x26; Object.hasOwn(err, 'reason') &#x26;&#x26; err.reason === null; // true
940
+ * err && Object.hasOwn(err, 'reason') && err.reason === null; // true
983
941
  * });
984
942
  * ```
985
943
  * @since v8.2.0
@@ -1070,11 +1028,11 @@ declare module "util" {
1070
1028
  * that returns promises.
1071
1029
  *
1072
1030
  * ```js
1073
- * const util = require('node:util');
1074
- * const fs = require('node:fs');
1031
+ * import { promisify } from 'node:util';
1032
+ * import { stat } from 'node:fs';
1075
1033
  *
1076
- * const stat = util.promisify(fs.stat);
1077
- * stat('.').then((stats) => {
1034
+ * const promisifiedStat = promisify(stat);
1035
+ * promisifiedStat('.').then((stats) => {
1078
1036
  * // Do something with `stats`
1079
1037
  * }).catch((error) => {
1080
1038
  * // Handle the error.
@@ -1084,23 +1042,25 @@ declare module "util" {
1084
1042
  * Or, equivalently using `async function`s:
1085
1043
  *
1086
1044
  * ```js
1087
- * const util = require('node:util');
1088
- * const fs = require('node:fs');
1045
+ * import { promisify } from 'node:util';
1046
+ * import { stat } from 'node:fs';
1089
1047
  *
1090
- * const stat = util.promisify(fs.stat);
1048
+ * const promisifiedStat = promisify(stat);
1091
1049
  *
1092
1050
  * async function callStat() {
1093
- * const stats = await stat('.');
1051
+ * const stats = await promisifiedStat('.');
1094
1052
  * console.log(`This directory is owned by ${stats.uid}`);
1095
1053
  * }
1096
1054
  *
1097
1055
  * callStat();
1098
1056
  * ```
1099
1057
  *
1100
- * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
1058
+ * If there is an `original[util.promisify.custom]` property present, `promisify`
1059
+ * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v24.x/api/util.html#custom-promisified-functions).
1101
1060
  *
1102
1061
  * `promisify()` assumes that `original` is a function taking a callback as its
1103
- * final argument in all cases. If `original` is not a function, `promisify()`will throw an error. If `original` is a function but its last argument is not
1062
+ * final argument in all cases. If `original` is not a function, `promisify()`
1063
+ * will throw an error. If `original` is a function but its last argument is not
1104
1064
  * an error-first callback, it will still be passed an error-first
1105
1065
  * callback as its last argument.
1106
1066
  *
@@ -1108,7 +1068,7 @@ declare module "util" {
1108
1068
  * work as expected unless handled specially:
1109
1069
  *
1110
1070
  * ```js
1111
- * const util = require('node:util');
1071
+ * import { promisify } from 'node:util';
1112
1072
  *
1113
1073
  * class Foo {
1114
1074
  * constructor() {
@@ -1122,8 +1082,8 @@ declare module "util" {
1122
1082
  *
1123
1083
  * const foo = new Foo();
1124
1084
  *
1125
- * const naiveBar = util.promisify(foo.bar);
1126
- * // TypeError: Cannot read property 'a' of undefined
1085
+ * const naiveBar = promisify(foo.bar);
1086
+ * // TypeError: Cannot read properties of undefined (reading 'a')
1127
1087
  * // naiveBar().then(a => console.log(a));
1128
1088
  *
1129
1089
  * naiveBar.call(foo).then((a) => console.log(a)); // '42'
@@ -1173,6 +1133,143 @@ declare module "util" {
1173
1133
  */
1174
1134
  const custom: unique symbol;
1175
1135
  }
1136
+ /**
1137
+ * Stability: 1.1 - Active development
1138
+ * Given an example `.env` file:
1139
+ *
1140
+ * ```js
1141
+ * import { parseEnv } from 'node:util';
1142
+ *
1143
+ * parseEnv('HELLO=world\nHELLO=oh my\n');
1144
+ * // Returns: { HELLO: 'oh my' }
1145
+ * ```
1146
+ * @param content The raw contents of a `.env` file.
1147
+ * @since v20.12.0
1148
+ */
1149
+ export function parseEnv(content: string): NodeJS.Dict<string>;
1150
+ // https://nodejs.org/docs/latest/api/util.html#foreground-colors
1151
+ type ForegroundColors =
1152
+ | "black"
1153
+ | "blackBright"
1154
+ | "blue"
1155
+ | "blueBright"
1156
+ | "cyan"
1157
+ | "cyanBright"
1158
+ | "gray"
1159
+ | "green"
1160
+ | "greenBright"
1161
+ | "grey"
1162
+ | "magenta"
1163
+ | "magentaBright"
1164
+ | "red"
1165
+ | "redBright"
1166
+ | "white"
1167
+ | "whiteBright"
1168
+ | "yellow"
1169
+ | "yellowBright";
1170
+ // https://nodejs.org/docs/latest/api/util.html#background-colors
1171
+ type BackgroundColors =
1172
+ | "bgBlack"
1173
+ | "bgBlackBright"
1174
+ | "bgBlue"
1175
+ | "bgBlueBright"
1176
+ | "bgCyan"
1177
+ | "bgCyanBright"
1178
+ | "bgGray"
1179
+ | "bgGreen"
1180
+ | "bgGreenBright"
1181
+ | "bgGrey"
1182
+ | "bgMagenta"
1183
+ | "bgMagentaBright"
1184
+ | "bgRed"
1185
+ | "bgRedBright"
1186
+ | "bgWhite"
1187
+ | "bgWhiteBright"
1188
+ | "bgYellow"
1189
+ | "bgYellowBright";
1190
+ // https://nodejs.org/docs/latest/api/util.html#modifiers
1191
+ type Modifiers =
1192
+ | "blink"
1193
+ | "bold"
1194
+ | "dim"
1195
+ | "doubleunderline"
1196
+ | "framed"
1197
+ | "hidden"
1198
+ | "inverse"
1199
+ | "italic"
1200
+ | "none"
1201
+ | "overlined"
1202
+ | "reset"
1203
+ | "strikethrough"
1204
+ | "underline";
1205
+ export interface StyleTextOptions {
1206
+ /**
1207
+ * When true, `stream` is checked to see if it can handle colors.
1208
+ * @default true
1209
+ */
1210
+ validateStream?: boolean | undefined;
1211
+ /**
1212
+ * A stream that will be validated if it can be colored.
1213
+ * @default process.stdout
1214
+ */
1215
+ stream?: NodeJS.WritableStream | undefined;
1216
+ }
1217
+ /**
1218
+ * This function returns a formatted text considering the `format` passed
1219
+ * for printing in a terminal. It is aware of the terminal's capabilities
1220
+ * and acts according to the configuration set via `NO_COLOR`,
1221
+ * `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.
1222
+ *
1223
+ * ```js
1224
+ * import { styleText } from 'node:util';
1225
+ * import { stderr } from 'node:process';
1226
+ *
1227
+ * const successMessage = styleText('green', 'Success!');
1228
+ * console.log(successMessage);
1229
+ *
1230
+ * const errorMessage = styleText(
1231
+ * 'red',
1232
+ * 'Error! Error!',
1233
+ * // Validate if process.stderr has TTY
1234
+ * { stream: stderr },
1235
+ * );
1236
+ * console.error(errorMessage);
1237
+ * ```
1238
+ *
1239
+ * `util.inspect.colors` also provides text formats such as `italic`, and
1240
+ * `underline` and you can combine both:
1241
+ *
1242
+ * ```js
1243
+ * console.log(
1244
+ * util.styleText(['underline', 'italic'], 'My italic underlined message'),
1245
+ * );
1246
+ * ```
1247
+ *
1248
+ * When passing an array of formats, the order of the format applied
1249
+ * is left to right so the following style might overwrite the previous one.
1250
+ *
1251
+ * ```js
1252
+ * console.log(
1253
+ * util.styleText(['red', 'green'], 'text'), // green
1254
+ * );
1255
+ * ```
1256
+ *
1257
+ * The special format value `none` applies no additional styling to the text.
1258
+ *
1259
+ * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v24.x/api/util.html#modifiers).
1260
+ * @param format A text format or an Array of text formats defined in `util.inspect.colors`.
1261
+ * @param text The text to to be formatted.
1262
+ * @since v20.12.0
1263
+ */
1264
+ export function styleText(
1265
+ format:
1266
+ | ForegroundColors
1267
+ | BackgroundColors
1268
+ | Modifiers
1269
+ | Array<ForegroundColors | BackgroundColors | Modifiers>,
1270
+ text: string,
1271
+ options?: StyleTextOptions,
1272
+ ): string;
1176
1273
  /**
1177
1274
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
1178
1275
  *
@@ -1210,7 +1307,7 @@ declare module "util" {
1210
1307
  * incomplete byte sequences occurring at the end of the `input` are buffered
1211
1308
  * internally and emitted after the next call to `textDecoder.decode()`.
1212
1309
  *
1213
- * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown.
1310
+ * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown.
1214
1311
  * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data.
1215
1312
  */
1216
1313
  decode(
@@ -1255,7 +1352,7 @@ declare module "util" {
1255
1352
  * encoded bytes.
1256
1353
  * @param [input='an empty string'] The text to encode.
1257
1354
  */
1258
- encode(input?: string): Uint8Array;
1355
+ encode(input?: string): NodeJS.NonSharedUint8Array;
1259
1356
  /**
1260
1357
  * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
1261
1358
  * containing the read Unicode code units and written UTF-8 bytes.
@@ -1274,7 +1371,7 @@ declare module "util" {
1274
1371
  import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
1275
1372
  global {
1276
1373
  /**
1277
- * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1374
+ * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
1278
1375
  * https://nodejs.org/api/globals.html#textdecoder
1279
1376
  * @since v11.0.0
1280
1377
  */
@@ -1284,7 +1381,7 @@ declare module "util" {
1284
1381
  } ? TextDecoder
1285
1382
  : typeof _TextDecoder;
1286
1383
  /**
1287
- * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1384
+ * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
1288
1385
  * https://nodejs.org/api/globals.html#textencoder
1289
1386
  * @since v11.0.0
1290
1387
  */
@@ -1325,11 +1422,17 @@ declare module "util" {
1325
1422
  * @return The parsed command line arguments:
1326
1423
  */
1327
1424
  export function parseArgs<T extends ParseArgsConfig>(config?: T): ParsedResults<T>;
1328
- interface ParseArgsOptionConfig {
1425
+
1426
+ /**
1427
+ * Type of argument used in {@link parseArgs}.
1428
+ */
1429
+ export type ParseArgsOptionsType = "boolean" | "string";
1430
+
1431
+ export interface ParseArgsOptionDescriptor {
1329
1432
  /**
1330
1433
  * Type of argument.
1331
1434
  */
1332
- type: "string" | "boolean";
1435
+ type: ParseArgsOptionsType;
1333
1436
  /**
1334
1437
  * Whether this option can be provided multiple times.
1335
1438
  * If `true`, all values will be collected in an array.
@@ -1342,21 +1445,24 @@ declare module "util" {
1342
1445
  */
1343
1446
  short?: string | undefined;
1344
1447
  /**
1345
- * The default option value when it is not set by args.
1346
- * It must be of the same type as the the `type` property.
1347
- * When `multiple` is `true`, it must be an array.
1448
+ * The value to assign to
1449
+ * the option if it does not appear in the arguments to be parsed. The value
1450
+ * must match the type specified by the `type` property. If `multiple` is
1451
+ * `true`, it must be an array. No default value is applied when the option
1452
+ * does appear in the arguments to be parsed, even if the provided value
1453
+ * is falsy.
1348
1454
  * @since v18.11.0
1349
1455
  */
1350
1456
  default?: string | boolean | string[] | boolean[] | undefined;
1351
1457
  }
1352
- interface ParseArgsOptionsConfig {
1353
- [longOption: string]: ParseArgsOptionConfig;
1458
+ export interface ParseArgsOptionsConfig {
1459
+ [longOption: string]: ParseArgsOptionDescriptor;
1354
1460
  }
1355
1461
  export interface ParseArgsConfig {
1356
1462
  /**
1357
1463
  * Array of argument strings.
1358
1464
  */
1359
- args?: string[] | undefined;
1465
+ args?: readonly string[] | undefined;
1360
1466
  /**
1361
1467
  * Used to describe arguments known to the parser.
1362
1468
  */
@@ -1371,6 +1477,12 @@ declare module "util" {
1371
1477
  * Whether this command accepts positional arguments.
1372
1478
  */
1373
1479
  allowPositionals?: boolean | undefined;
1480
+ /**
1481
+ * If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`.
1482
+ * @default false
1483
+ * @since v22.4.0
1484
+ */
1485
+ allowNegative?: boolean | undefined;
1374
1486
  /**
1375
1487
  * Return the parsed tokens. This is useful for extending the built-in behavior,
1376
1488
  * from adding additional checks through to reprocessing the tokens in different ways.
@@ -1396,21 +1508,29 @@ declare module "util" {
1396
1508
  : T extends true ? IfTrue
1397
1509
  : IfFalse;
1398
1510
 
1399
- type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionConfig> = IfDefaultsTrue<
1511
+ type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionDescriptor> = IfDefaultsTrue<
1400
1512
  T["strict"],
1401
1513
  O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean,
1402
1514
  string | boolean
1403
1515
  >;
1404
1516
 
1517
+ type ApplyOptionalModifiers<O extends ParseArgsOptionsConfig, V extends Record<keyof O, unknown>> = (
1518
+ & { -readonly [LongOption in keyof O]?: V[LongOption] }
1519
+ & { [LongOption in keyof O as O[LongOption]["default"] extends {} ? LongOption : never]: V[LongOption] }
1520
+ ) extends infer P ? { [K in keyof P]: P[K] } : never; // resolve intersection to object
1521
+
1405
1522
  type ParsedValues<T extends ParseArgsConfig> =
1406
1523
  & IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
1407
- & (T["options"] extends ParseArgsOptionsConfig ? {
1408
- -readonly [LongOption in keyof T["options"]]: IfDefaultsFalse<
1409
- T["options"][LongOption]["multiple"],
1410
- undefined | Array<ExtractOptionValue<T, T["options"][LongOption]>>,
1411
- undefined | ExtractOptionValue<T, T["options"][LongOption]>
1412
- >;
1413
- }
1524
+ & (T["options"] extends ParseArgsOptionsConfig ? ApplyOptionalModifiers<
1525
+ T["options"],
1526
+ {
1527
+ [LongOption in keyof T["options"]]: IfDefaultsFalse<
1528
+ T["options"][LongOption]["multiple"],
1529
+ Array<ExtractOptionValue<T, T["options"][LongOption]>>,
1530
+ ExtractOptionValue<T, T["options"][LongOption]>
1531
+ >;
1532
+ }
1533
+ >
1414
1534
  : {});
1415
1535
 
1416
1536
  type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
@@ -1421,7 +1541,7 @@ declare module "util" {
1421
1541
 
1422
1542
  type PreciseTokenForOptions<
1423
1543
  K extends string,
1424
- O extends ParseArgsOptionConfig,
1544
+ O extends ParseArgsOptionDescriptor,
1425
1545
  > = O["type"] extends "string" ? {
1426
1546
  kind: "option";
1427
1547
  index: number;
@@ -1511,7 +1631,6 @@ declare module "util" {
1511
1631
  * components. When parsed, a `MIMEType` object is returned containing
1512
1632
  * properties for each of these components.
1513
1633
  * @since v19.1.0, v18.13.0
1514
- * @experimental
1515
1634
  */
1516
1635
  export class MIMEType {
1517
1636
  /**
@@ -1589,7 +1708,7 @@ declare module "util" {
1589
1708
  toString(): string;
1590
1709
  }
1591
1710
  /**
1592
- * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`.
1711
+ * The `MIMEParams` API provides read and write access to the parameters of a `MIMEType`.
1593
1712
  * @since v19.1.0, v18.13.0
1594
1713
  */
1595
1714
  export class MIMEParams {
@@ -1602,7 +1721,7 @@ declare module "util" {
1602
1721
  * Each item of the iterator is a JavaScript `Array`. The first item of the array
1603
1722
  * is the `name`, the second item of the array is the `value`.
1604
1723
  */
1605
- entries(): IterableIterator<[name: string, value: string]>;
1724
+ entries(): NodeJS.Iterator<[name: string, value: string]>;
1606
1725
  /**
1607
1726
  * Returns the value of the first name-value pair whose name is `name`. If there
1608
1727
  * are no such pairs, `null` is returned.
@@ -1628,9 +1747,9 @@ declare module "util" {
1628
1747
  * // bar
1629
1748
  * ```
1630
1749
  */
1631
- keys(): IterableIterator<string>;
1750
+ keys(): NodeJS.Iterator<string>;
1632
1751
  /**
1633
- * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`,
1752
+ * Sets the value in the `MIMEParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`,
1634
1753
  * set the first such pair's value to `value`.
1635
1754
  *
1636
1755
  * ```js
@@ -1647,16 +1766,13 @@ declare module "util" {
1647
1766
  /**
1648
1767
  * Returns an iterator over the values of each name-value pair.
1649
1768
  */
1650
- values(): IterableIterator<string>;
1769
+ values(): NodeJS.Iterator<string>;
1651
1770
  /**
1652
1771
  * Returns an iterator over each of the name-value pairs in the parameters.
1653
1772
  */
1654
- [Symbol.iterator]: typeof MIMEParams.prototype.entries;
1773
+ [Symbol.iterator](): NodeJS.Iterator<[name: string, value: string]>;
1655
1774
  }
1656
1775
  }
1657
- declare module "util/types" {
1658
- export * from "util/types";
1659
- }
1660
1776
  declare module "util/types" {
1661
1777
  import { KeyObject, webcrypto } from "node:crypto";
1662
1778
  /**
@@ -1732,6 +1848,18 @@ declare module "util/types" {
1732
1848
  * @since v10.0.0
1733
1849
  */
1734
1850
  function isBigInt64Array(value: unknown): value is BigInt64Array;
1851
+ /**
1852
+ * Returns `true` if the value is a BigInt object, e.g. created
1853
+ * by `Object(BigInt(123))`.
1854
+ *
1855
+ * ```js
1856
+ * util.types.isBigIntObject(Object(BigInt(123))); // Returns true
1857
+ * util.types.isBigIntObject(BigInt(123)); // Returns false
1858
+ * util.types.isBigIntObject(123); // Returns false
1859
+ * ```
1860
+ * @since v10.4.0
1861
+ */
1862
+ function isBigIntObject(object: unknown): object is BigInt;
1735
1863
  /**
1736
1864
  * Returns `true` if the value is a `BigUint64Array` instance.
1737
1865
  *
@@ -1801,7 +1929,9 @@ declare module "util/types" {
1801
1929
  * A native `External` value is a special type of object that contains a
1802
1930
  * raw C++ pointer (`void*`) for access from native code, and has no other
1803
1931
  * properties. Such objects are created either by Node.js internals or native
1804
- * addons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a`null` prototype.
1932
+ * addons. In JavaScript, they are
1933
+ * [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a
1934
+ * `null` prototype.
1805
1935
  *
1806
1936
  * ```c
1807
1937
  * #include <js_native_api.h>
@@ -1809,7 +1939,7 @@ declare module "util/types" {
1809
1939
  * napi_value result;
1810
1940
  * static napi_value MyNapi(napi_env env, napi_callback_info info) {
1811
1941
  * int* raw = (int*) malloc(1024);
1812
- * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &#x26;result);
1942
+ * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
1813
1943
  * if (status != napi_ok) {
1814
1944
  * napi_throw_error(env, NULL, "napi_create_external failed");
1815
1945
  * return NULL;
@@ -1822,17 +1952,31 @@ declare module "util/types" {
1822
1952
  * ```
1823
1953
  *
1824
1954
  * ```js
1825
- * const native = require('napi_addon.node');
1955
+ * import native from 'napi_addon.node';
1956
+ * import { types } from 'node:util';
1957
+ *
1826
1958
  * const data = native.myNapi();
1827
- * util.types.isExternal(data); // returns true
1828
- * util.types.isExternal(0); // returns false
1829
- * util.types.isExternal(new String('foo')); // returns false
1959
+ * types.isExternal(data); // returns true
1960
+ * types.isExternal(0); // returns false
1961
+ * types.isExternal(new String('foo')); // returns false
1830
1962
  * ```
1831
1963
  *
1832
- * For further information on `napi_create_external`, refer to `napi_create_external()`.
1964
+ * For further information on `napi_create_external`, refer to
1965
+ * [`napi_create_external()`](https://nodejs.org/docs/latest-v24.x/api/n-api.html#napi_create_external).
1833
1966
  * @since v10.0.0
1834
1967
  */
1835
1968
  function isExternal(object: unknown): boolean;
1969
+ /**
1970
+ * Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance.
1971
+ *
1972
+ * ```js
1973
+ * util.types.isFloat16Array(new ArrayBuffer()); // Returns false
1974
+ * util.types.isFloat16Array(new Float16Array()); // Returns true
1975
+ * util.types.isFloat16Array(new Float32Array()); // Returns false
1976
+ * ```
1977
+ * @since v24.0.0
1978
+ */
1979
+ function isFloat16Array(object: unknown): object is Float16Array;
1836
1980
  /**
1837
1981
  * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
1838
1982
  *
@@ -1953,7 +2097,8 @@ declare module "util/types" {
1953
2097
  */
1954
2098
  function isModuleNamespaceObject(value: unknown): boolean;
1955
2099
  /**
1956
- * Returns `true` if the value was returned by the constructor of a [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
2100
+ * Returns `true` if the value was returned by the constructor of a
2101
+ * [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
1957
2102
  *
1958
2103
  * ```js
1959
2104
  * console.log(util.types.isNativeError(new Error())); // true
@@ -1968,14 +2113,18 @@ declare module "util/types" {
1968
2113
  * console.log(util.types.isNativeError(new MyError())); // true
1969
2114
  * ```
1970
2115
  *
1971
- * A value being `instanceof` a native error class is not equivalent to `isNativeError()`returning `true` for that value. `isNativeError()` returns `true` for errors
1972
- * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`for these errors:
2116
+ * A value being `instanceof` a native error class is not equivalent to `isNativeError()`
2117
+ * returning `true` for that value. `isNativeError()` returns `true` for errors
2118
+ * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`
2119
+ * for these errors:
1973
2120
  *
1974
2121
  * ```js
1975
- * const vm = require('node:vm');
1976
- * const context = vm.createContext({});
1977
- * const myError = vm.runInContext('new Error()', context);
1978
- * console.log(util.types.isNativeError(myError)); // true
2122
+ * import { createContext, runInContext } from 'node:vm';
2123
+ * import { types } from 'node:util';
2124
+ *
2125
+ * const context = createContext({});
2126
+ * const myError = runInContext('new Error()', context);
2127
+ * console.log(types.isNativeError(myError)); // true
1979
2128
  * console.log(myError instanceof Error); // false
1980
2129
  * ```
1981
2130
  *
@@ -1989,6 +2138,7 @@ declare module "util/types" {
1989
2138
  * console.log(myError instanceof Error); // true
1990
2139
  * ```
1991
2140
  * @since v10.0.0
2141
+ * @deprecated The `util.types.isNativeError` API is deprecated. Please use `Error.isError` instead.
1992
2142
  */
1993
2143
  function isNativeError(object: unknown): object is Error;
1994
2144
  /**