omegon 0.8.3 → 0.9.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 (140) hide show
  1. package/extensions/cleave/dispatcher.ts +213 -20
  2. package/extensions/cleave/index.ts +24 -8
  3. package/extensions/cleave/rpc-child.ts +269 -0
  4. package/extensions/cleave/types.ts +52 -0
  5. package/extensions/openspec/spec.ts +3 -0
  6. package/node_modules/@types/node/README.md +3 -3
  7. package/node_modules/@types/node/assert/strict.d.ts +11 -5
  8. package/node_modules/@types/node/assert.d.ts +173 -50
  9. package/node_modules/@types/node/async_hooks.d.ts +8 -28
  10. package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
  11. package/node_modules/@types/node/buffer.d.ts +168 -44
  12. package/node_modules/@types/node/child_process.d.ts +70 -27
  13. package/node_modules/@types/node/cluster.d.ts +332 -240
  14. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  15. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  16. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  17. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  18. package/node_modules/@types/node/console.d.ts +350 -49
  19. package/node_modules/@types/node/constants.d.ts +4 -3
  20. package/node_modules/@types/node/crypto.d.ts +1110 -630
  21. package/node_modules/@types/node/dgram.d.ts +51 -15
  22. package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
  23. package/node_modules/@types/node/dns/promises.d.ts +4 -4
  24. package/node_modules/@types/node/dns.d.ts +133 -132
  25. package/node_modules/@types/node/domain.d.ts +17 -13
  26. package/node_modules/@types/node/events.d.ts +663 -734
  27. package/node_modules/@types/node/fs/promises.d.ts +9 -43
  28. package/node_modules/@types/node/fs.d.ts +411 -628
  29. package/node_modules/@types/node/globals.d.ts +30 -8
  30. package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
  31. package/node_modules/@types/node/http.d.ts +265 -364
  32. package/node_modules/@types/node/http2.d.ts +715 -551
  33. package/node_modules/@types/node/https.d.ts +239 -65
  34. package/node_modules/@types/node/index.d.ts +6 -24
  35. package/node_modules/@types/node/inspector.d.ts +53 -69
  36. package/node_modules/@types/node/inspector.generated.d.ts +410 -759
  37. package/node_modules/@types/node/module.d.ts +186 -52
  38. package/node_modules/@types/node/net.d.ts +194 -70
  39. package/node_modules/@types/node/os.d.ts +11 -12
  40. package/node_modules/@types/node/package.json +3 -13
  41. package/node_modules/@types/node/path.d.ts +133 -120
  42. package/node_modules/@types/node/perf_hooks.d.ts +643 -318
  43. package/node_modules/@types/node/process.d.ts +132 -223
  44. package/node_modules/@types/node/punycode.d.ts +5 -5
  45. package/node_modules/@types/node/querystring.d.ts +4 -4
  46. package/node_modules/@types/node/readline/promises.d.ts +3 -3
  47. package/node_modules/@types/node/readline.d.ts +120 -68
  48. package/node_modules/@types/node/repl.d.ts +100 -87
  49. package/node_modules/@types/node/sea.d.ts +1 -10
  50. package/node_modules/@types/node/sqlite.d.ts +19 -363
  51. package/node_modules/@types/node/stream/consumers.d.ts +10 -10
  52. package/node_modules/@types/node/stream/promises.d.ts +15 -136
  53. package/node_modules/@types/node/stream/web.d.ts +502 -176
  54. package/node_modules/@types/node/stream.d.ts +475 -581
  55. package/node_modules/@types/node/string_decoder.d.ts +4 -4
  56. package/node_modules/@types/node/test.d.ts +196 -308
  57. package/node_modules/@types/node/timers/promises.d.ts +4 -4
  58. package/node_modules/@types/node/timers.d.ts +132 -4
  59. package/node_modules/@types/node/tls.d.ts +226 -110
  60. package/node_modules/@types/node/trace_events.d.ts +9 -9
  61. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
  62. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
  63. package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
  64. package/node_modules/@types/node/tty.d.ts +16 -58
  65. package/node_modules/@types/node/url.d.ts +573 -130
  66. package/node_modules/@types/node/util.d.ts +1100 -181
  67. package/node_modules/@types/node/v8.d.ts +8 -76
  68. package/node_modules/@types/node/vm.d.ts +72 -280
  69. package/node_modules/@types/node/wasi.d.ts +4 -25
  70. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
  71. package/node_modules/@types/node/web-globals/events.d.ts +0 -9
  72. package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
  73. package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
  74. package/node_modules/@types/node/worker_threads.d.ts +335 -268
  75. package/node_modules/@types/node/zlib.d.ts +74 -9
  76. package/node_modules/undici-types/agent.d.ts +12 -13
  77. package/node_modules/undici-types/api.d.ts +26 -26
  78. package/node_modules/undici-types/balanced-pool.d.ts +12 -13
  79. package/node_modules/undici-types/client.d.ts +19 -19
  80. package/node_modules/undici-types/connector.d.ts +2 -2
  81. package/node_modules/undici-types/cookies.d.ts +0 -2
  82. package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
  83. package/node_modules/undici-types/dispatcher.d.ts +103 -123
  84. package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
  85. package/node_modules/undici-types/errors.d.ts +54 -66
  86. package/node_modules/undici-types/eventsource.d.ts +4 -9
  87. package/node_modules/undici-types/fetch.d.ts +20 -22
  88. package/node_modules/undici-types/file.d.ts +39 -0
  89. package/node_modules/undici-types/filereader.d.ts +54 -0
  90. package/node_modules/undici-types/formdata.d.ts +7 -7
  91. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  92. package/node_modules/undici-types/global-origin.d.ts +5 -5
  93. package/node_modules/undici-types/handlers.d.ts +8 -8
  94. package/node_modules/undici-types/header.d.ts +1 -157
  95. package/node_modules/undici-types/index.d.ts +47 -64
  96. package/node_modules/undici-types/interceptors.d.ts +8 -64
  97. package/node_modules/undici-types/mock-agent.d.ts +18 -36
  98. package/node_modules/undici-types/mock-client.d.ts +4 -6
  99. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  100. package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
  101. package/node_modules/undici-types/mock-pool.d.ts +4 -6
  102. package/node_modules/undici-types/package.json +1 -1
  103. package/node_modules/undici-types/patch.d.ts +4 -0
  104. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  105. package/node_modules/undici-types/pool.d.ts +13 -15
  106. package/node_modules/undici-types/proxy-agent.d.ts +4 -5
  107. package/node_modules/undici-types/readable.d.ts +16 -19
  108. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  109. package/node_modules/undici-types/retry-handler.d.ts +10 -19
  110. package/node_modules/undici-types/util.d.ts +3 -3
  111. package/node_modules/undici-types/webidl.d.ts +29 -142
  112. package/node_modules/undici-types/websocket.d.ts +10 -46
  113. package/package.json +2 -1
  114. package/skills/cleave/SKILL.md +62 -2
  115. package/node_modules/@types/node/inspector/promises.d.ts +0 -41
  116. package/node_modules/@types/node/path/posix.d.ts +0 -8
  117. package/node_modules/@types/node/path/win32.d.ts +0 -8
  118. package/node_modules/@types/node/quic.d.ts +0 -910
  119. package/node_modules/@types/node/test/reporters.d.ts +0 -96
  120. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  121. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  122. package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  123. package/node_modules/@types/node/util/types.d.ts +0 -558
  124. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  125. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  126. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  127. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  128. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  129. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  130. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  131. package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  132. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  133. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  134. package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
  135. package/node_modules/undici-types/client-stats.d.ts +0 -15
  136. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  137. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  138. package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
  139. package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
  140. package/node_modules/undici-types/utility.d.ts +0 -7
@@ -6,60 +6,10 @@
6
6
  * ```js
7
7
  * import util from 'node:util';
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/util.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/util.js)
10
10
  */
11
- declare module "node:util" {
12
- export * as types from "node:util/types";
13
- export type InspectStyle =
14
- | "special"
15
- | "number"
16
- | "bigint"
17
- | "boolean"
18
- | "undefined"
19
- | "null"
20
- | "string"
21
- | "symbol"
22
- | "date"
23
- | "name"
24
- | "regexp"
25
- | "module";
26
- export interface InspectStyles extends Record<InspectStyle, InspectColor | ((value: string) => string)> {
27
- regexp: {
28
- (value: string): string;
29
- colors: InspectColor[];
30
- };
31
- }
32
- export type InspectColorModifier =
33
- | "reset"
34
- | "bold"
35
- | "dim"
36
- | "italic"
37
- | "underline"
38
- | "blink"
39
- | "inverse"
40
- | "hidden"
41
- | "strikethrough"
42
- | "doubleunderline";
43
- export type InspectColorForeground =
44
- | "black"
45
- | "red"
46
- | "green"
47
- | "yellow"
48
- | "blue"
49
- | "magenta"
50
- | "cyan"
51
- | "white"
52
- | "gray"
53
- | "redBright"
54
- | "greenBright"
55
- | "yellowBright"
56
- | "blueBright"
57
- | "magentaBright"
58
- | "cyanBright"
59
- | "whiteBright";
60
- export type InspectColorBackground = `bg${Capitalize<InspectColorForeground>}`;
61
- export type InspectColor = InspectColorModifier | InspectColorForeground | InspectColorBackground;
62
- export interface InspectColors extends Record<InspectColor, [number, number]> {}
11
+ declare module "util" {
12
+ import * as types from "node:util/types";
63
13
  export interface InspectOptions {
64
14
  /**
65
15
  * If `true`, object's non-enumerable symbols and properties are included in the formatted result.
@@ -142,26 +92,22 @@ declare module "node:util" {
142
92
  */
143
93
  numericSeparator?: boolean | undefined;
144
94
  }
145
- export interface InspectContext extends Required<InspectOptions> {
146
- stylize(text: string, styleType: InspectStyle): string;
147
- }
148
- import _inspect = inspect;
149
- export interface Inspectable {
150
- [inspect.custom](depth: number, options: InspectContext, inspect: typeof _inspect): any;
95
+ export type Style =
96
+ | "special"
97
+ | "number"
98
+ | "bigint"
99
+ | "boolean"
100
+ | "undefined"
101
+ | "null"
102
+ | "string"
103
+ | "symbol"
104
+ | "date"
105
+ | "regexp"
106
+ | "module";
107
+ export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect
108
+ export interface InspectOptionsStylized extends InspectOptions {
109
+ stylize(text: string, styleType: Style): string;
151
110
  }
152
- // TODO: Remove these in a future major
153
- /** @deprecated Use `InspectStyle` instead. */
154
- export type Style = Exclude<InspectStyle, "name">;
155
- /** @deprecated Use the `Inspectable` interface instead. */
156
- export type CustomInspectFunction = (depth: number, options: InspectContext) => any;
157
- /** @deprecated Use `InspectContext` instead. */
158
- export interface InspectOptionsStylized extends InspectContext {}
159
- /** @deprecated Use `InspectColorModifier` instead. */
160
- export type Modifiers = InspectColorModifier;
161
- /** @deprecated Use `InspectColorForeground` instead. */
162
- export type ForegroundColors = InspectColorForeground;
163
- /** @deprecated Use `InspectColorBackground` instead. */
164
- export type BackgroundColors = InspectColorBackground;
165
111
  export interface CallSiteObject {
166
112
  /**
167
113
  * Returns the name of the function associated with this call site.
@@ -297,7 +243,7 @@ declare module "node:util" {
297
243
  * @since v10.0.0
298
244
  */
299
245
  export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
300
- export interface GetCallSitesOptions {
246
+ interface GetCallSitesOptions {
301
247
  /**
302
248
  * Reconstruct the original location in the stacktrace from the source-map.
303
249
  * Enabled by default with the flag `--enable-source-maps`.
@@ -308,9 +254,6 @@ declare module "node:util" {
308
254
  * Returns an array of call site objects containing the stack of
309
255
  * the caller function.
310
256
  *
311
- * Unlike accessing an `error.stack`, the result returned from this API is not
312
- * interfered with `Error.prepareStackTrace`.
313
- *
314
257
  * ```js
315
258
  * import { getCallSites } from 'node:util';
316
259
  *
@@ -323,7 +266,7 @@ declare module "node:util" {
323
266
  * console.log(`Function Name: ${callSite.functionName}`);
324
267
  * console.log(`Script Name: ${callSite.scriptName}`);
325
268
  * console.log(`Line Number: ${callSite.lineNumber}`);
326
- * console.log(`Column Number: ${callSite.columnNumber}`);
269
+ * console.log(`Column Number: ${callSite.column}`);
327
270
  * });
328
271
  * // CallSite 1:
329
272
  * // Function Name: exampleFunction
@@ -397,7 +340,7 @@ declare module "node:util" {
397
340
  export function getSystemErrorName(err: number): string;
398
341
  /**
399
342
  * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.
400
- * @since 24.6.0
343
+ * @since 22.19.0
401
344
  */
402
345
  export function setTraceSigInt(enable: boolean): void;
403
346
  /**
@@ -429,6 +372,19 @@ declare module "node:util" {
429
372
  * @since v22.12.0
430
373
  */
431
374
  export function getSystemErrorMessage(err: number): string;
375
+ /**
376
+ * The `util.log()` method prints the given `string` to `stdout` with an included
377
+ * timestamp.
378
+ *
379
+ * ```js
380
+ * import util from 'node:util';
381
+ *
382
+ * util.log('Timestamped message.');
383
+ * ```
384
+ * @since v0.3.0
385
+ * @deprecated Since v6.0.0 - Use a third party module instead.
386
+ */
387
+ export function log(string: string): void;
432
388
  /**
433
389
  * Returns the `string` after replacing any surrogate code points
434
390
  * (or equivalently, any unpaired surrogate code units) with the
@@ -666,11 +622,19 @@ declare module "node:util" {
666
622
  export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
667
623
  export function inspect(object: any, options?: InspectOptions): string;
668
624
  export namespace inspect {
669
- const custom: unique symbol;
670
- let colors: InspectColors;
671
- let styles: InspectStyles;
625
+ let colors: NodeJS.Dict<[number, number]>;
626
+ let styles: {
627
+ [K in Style]: string;
628
+ };
672
629
  let defaultOptions: InspectOptions;
630
+ /**
631
+ * Allows changing inspect settings from the repl.
632
+ */
673
633
  let replDefaults: InspectOptions;
634
+ /**
635
+ * That can be used to declare custom inspect functions.
636
+ */
637
+ const custom: unique symbol;
674
638
  }
675
639
  /**
676
640
  * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).
@@ -691,6 +655,71 @@ declare module "node:util" {
691
655
  * @deprecated Since v4.0.0 - Use `isArray` instead.
692
656
  */
693
657
  export function isArray(object: unknown): object is unknown[];
658
+ /**
659
+ * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
660
+ *
661
+ * ```js
662
+ * import util from 'node:util';
663
+ *
664
+ * util.isRegExp(/some regexp/);
665
+ * // Returns: true
666
+ * util.isRegExp(new RegExp('another regexp'));
667
+ * // Returns: true
668
+ * util.isRegExp({});
669
+ * // Returns: false
670
+ * ```
671
+ * @since v0.6.0
672
+ * @deprecated Since v4.0.0 - Deprecated
673
+ */
674
+ export function isRegExp(object: unknown): object is RegExp;
675
+ /**
676
+ * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
677
+ *
678
+ * ```js
679
+ * import util from 'node:util';
680
+ *
681
+ * util.isDate(new Date());
682
+ * // Returns: true
683
+ * util.isDate(Date());
684
+ * // false (without 'new' returns a String)
685
+ * util.isDate({});
686
+ * // Returns: false
687
+ * ```
688
+ * @since v0.6.0
689
+ * @deprecated Since v4.0.0 - Use {@link types.isDate} instead.
690
+ */
691
+ export function isDate(object: unknown): object is Date;
692
+ /**
693
+ * Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`.
694
+ *
695
+ * ```js
696
+ * import util from 'node:util';
697
+ *
698
+ * util.isError(new Error());
699
+ * // Returns: true
700
+ * util.isError(new TypeError());
701
+ * // Returns: true
702
+ * util.isError({ name: 'Error', message: 'an error occurred' });
703
+ * // Returns: false
704
+ * ```
705
+ *
706
+ * This method relies on `Object.prototype.toString()` behavior. It is
707
+ * possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`.
708
+ *
709
+ * ```js
710
+ * import util from 'node:util';
711
+ * const obj = { name: 'Error', message: 'an error occurred' };
712
+ *
713
+ * util.isError(obj);
714
+ * // Returns: false
715
+ * obj[Symbol.toStringTag] = 'Error';
716
+ * util.isError(obj);
717
+ * // Returns: true
718
+ * ```
719
+ * @since v0.6.0
720
+ * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead.
721
+ */
722
+ export function isError(object: unknown): object is Error;
694
723
  /**
695
724
  * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and
696
725
  * `extends` keywords to get language level inheritance support. Also note
@@ -753,28 +782,6 @@ declare module "node:util" {
753
782
  * @legacy Use ES2015 class syntax and `extends` keyword instead.
754
783
  */
755
784
  export function inherits(constructor: unknown, superConstructor: unknown): void;
756
- /**
757
- * The `util.convertProcessSignalToExitCode()` method converts a signal name to its
758
- * corresponding POSIX exit code. Following the POSIX standard, the exit code
759
- * for a process terminated by a signal is calculated as `128 + signal number`.
760
- *
761
- * If `signal` is not a valid signal name, then an error will be thrown. See
762
- * [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.
763
- *
764
- * ```js
765
- * import { convertProcessSignalToExitCode } from 'node:util';
766
- *
767
- * console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
768
- * console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)
769
- * ```
770
- *
771
- * This is particularly useful when working with processes to determine
772
- * the exit code based on the signal that terminated the process.
773
- * @since v25.4.0
774
- * @param signal A signal name (e.g. `'SIGTERM'`)
775
- * @returns The exit code corresponding to `signal`
776
- */
777
- export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number;
778
785
  export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
779
786
  export interface DebugLogger extends DebugLoggerFunction {
780
787
  /**
@@ -829,7 +836,7 @@ declare module "node:util" {
829
836
  *
830
837
  * ```js
831
838
  * import { debuglog } from 'node:util';
832
- * const log = debuglog('foo-bar');
839
+ * const log = debuglog('foo');
833
840
  *
834
841
  * log('hi there, it\'s foo-bar [%d]', 2333);
835
842
  * ```
@@ -863,15 +870,217 @@ declare module "node:util" {
863
870
  */
864
871
  export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
865
872
  export { debuglog as debug };
866
- export interface DeprecateOptions {
867
- /**
868
- * When false do not change the prototype of object
869
- * while emitting the deprecation warning.
870
- * @since v25.2.0
871
- * @default true
872
- */
873
- modifyPrototype?: boolean | undefined;
874
- }
873
+ /**
874
+ * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
875
+ *
876
+ * ```js
877
+ * import util from 'node:util';
878
+ *
879
+ * util.isBoolean(1);
880
+ * // Returns: false
881
+ * util.isBoolean(0);
882
+ * // Returns: false
883
+ * util.isBoolean(false);
884
+ * // Returns: true
885
+ * ```
886
+ * @since v0.11.5
887
+ * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead.
888
+ */
889
+ export function isBoolean(object: unknown): object is boolean;
890
+ /**
891
+ * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
892
+ *
893
+ * ```js
894
+ * import util from 'node:util';
895
+ *
896
+ * util.isBuffer({ length: 0 });
897
+ * // Returns: false
898
+ * util.isBuffer([]);
899
+ * // Returns: false
900
+ * util.isBuffer(Buffer.from('hello world'));
901
+ * // Returns: true
902
+ * ```
903
+ * @since v0.11.5
904
+ * @deprecated Since v4.0.0 - Use `isBuffer` instead.
905
+ */
906
+ export function isBuffer(object: unknown): object is Buffer;
907
+ /**
908
+ * Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`.
909
+ *
910
+ * ```js
911
+ * import util from 'node:util';
912
+ *
913
+ * function Foo() {}
914
+ * const Bar = () => {};
915
+ *
916
+ * util.isFunction({});
917
+ * // Returns: false
918
+ * util.isFunction(Foo);
919
+ * // Returns: true
920
+ * util.isFunction(Bar);
921
+ * // Returns: true
922
+ * ```
923
+ * @since v0.11.5
924
+ * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead.
925
+ */
926
+ export function isFunction(object: unknown): boolean;
927
+ /**
928
+ * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
929
+ *
930
+ * ```js
931
+ * import util from 'node:util';
932
+ *
933
+ * util.isNull(0);
934
+ * // Returns: false
935
+ * util.isNull(undefined);
936
+ * // Returns: false
937
+ * util.isNull(null);
938
+ * // Returns: true
939
+ * ```
940
+ * @since v0.11.5
941
+ * @deprecated Since v4.0.0 - Use `value === null` instead.
942
+ */
943
+ export function isNull(object: unknown): object is null;
944
+ /**
945
+ * Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
946
+ * returns `false`.
947
+ *
948
+ * ```js
949
+ * import util from 'node:util';
950
+ *
951
+ * util.isNullOrUndefined(0);
952
+ * // Returns: false
953
+ * util.isNullOrUndefined(undefined);
954
+ * // Returns: true
955
+ * util.isNullOrUndefined(null);
956
+ * // Returns: true
957
+ * ```
958
+ * @since v0.11.5
959
+ * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
960
+ */
961
+ export function isNullOrUndefined(object: unknown): object is null | undefined;
962
+ /**
963
+ * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
964
+ *
965
+ * ```js
966
+ * import util from 'node:util';
967
+ *
968
+ * util.isNumber(false);
969
+ * // Returns: false
970
+ * util.isNumber(Infinity);
971
+ * // Returns: true
972
+ * util.isNumber(0);
973
+ * // Returns: true
974
+ * util.isNumber(NaN);
975
+ * // Returns: true
976
+ * ```
977
+ * @since v0.11.5
978
+ * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead.
979
+ */
980
+ export function isNumber(object: unknown): object is number;
981
+ /**
982
+ * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript).
983
+ * Otherwise, returns `false`.
984
+ *
985
+ * ```js
986
+ * import util from 'node:util';
987
+ *
988
+ * util.isObject(5);
989
+ * // Returns: false
990
+ * util.isObject(null);
991
+ * // Returns: false
992
+ * util.isObject({});
993
+ * // Returns: true
994
+ * util.isObject(() => {});
995
+ * // Returns: false
996
+ * ```
997
+ * @since v0.11.5
998
+ * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead.
999
+ */
1000
+ export function isObject(object: unknown): boolean;
1001
+ /**
1002
+ * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
1003
+ *
1004
+ * ```js
1005
+ * import util from 'node:util';
1006
+ *
1007
+ * util.isPrimitive(5);
1008
+ * // Returns: true
1009
+ * util.isPrimitive('foo');
1010
+ * // Returns: true
1011
+ * util.isPrimitive(false);
1012
+ * // Returns: true
1013
+ * util.isPrimitive(null);
1014
+ * // Returns: true
1015
+ * util.isPrimitive(undefined);
1016
+ * // Returns: true
1017
+ * util.isPrimitive({});
1018
+ * // Returns: false
1019
+ * util.isPrimitive(() => {});
1020
+ * // Returns: false
1021
+ * util.isPrimitive(/^$/);
1022
+ * // Returns: false
1023
+ * util.isPrimitive(new Date());
1024
+ * // Returns: false
1025
+ * ```
1026
+ * @since v0.11.5
1027
+ * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead.
1028
+ */
1029
+ export function isPrimitive(object: unknown): boolean;
1030
+ /**
1031
+ * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
1032
+ *
1033
+ * ```js
1034
+ * import util from 'node:util';
1035
+ *
1036
+ * util.isString('');
1037
+ * // Returns: true
1038
+ * util.isString('foo');
1039
+ * // Returns: true
1040
+ * util.isString(String('foo'));
1041
+ * // Returns: true
1042
+ * util.isString(5);
1043
+ * // Returns: false
1044
+ * ```
1045
+ * @since v0.11.5
1046
+ * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead.
1047
+ */
1048
+ export function isString(object: unknown): object is string;
1049
+ /**
1050
+ * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
1051
+ *
1052
+ * ```js
1053
+ * import util from 'node:util';
1054
+ *
1055
+ * util.isSymbol(5);
1056
+ * // Returns: false
1057
+ * util.isSymbol('foo');
1058
+ * // Returns: false
1059
+ * util.isSymbol(Symbol('foo'));
1060
+ * // Returns: true
1061
+ * ```
1062
+ * @since v0.11.5
1063
+ * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead.
1064
+ */
1065
+ export function isSymbol(object: unknown): object is symbol;
1066
+ /**
1067
+ * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
1068
+ *
1069
+ * ```js
1070
+ * import util from 'node:util';
1071
+ *
1072
+ * const foo = undefined;
1073
+ * util.isUndefined(5);
1074
+ * // Returns: false
1075
+ * util.isUndefined(foo);
1076
+ * // Returns: true
1077
+ * util.isUndefined(null);
1078
+ * // Returns: false
1079
+ * ```
1080
+ * @since v0.11.5
1081
+ * @deprecated Since v4.0.0 - Use `value === undefined` instead.
1082
+ */
1083
+ export function isUndefined(object: unknown): object is undefined;
875
1084
  /**
876
1085
  * The `util.deprecate()` method wraps `fn` (which may be a function or class) in
877
1086
  * such a way that it is marked as deprecated.
@@ -932,16 +1141,7 @@ declare module "node:util" {
932
1141
  * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
933
1142
  * @return The deprecated function wrapped to emit a warning.
934
1143
  */
935
- export function deprecate<T extends Function>(fn: T, msg: string, code?: string, options?: DeprecateOptions): T;
936
- export interface IsDeepStrictEqualOptions {
937
- /**
938
- * If `true`, prototype and constructor
939
- * comparison is skipped during deep strict equality check.
940
- * @since v24.9.0
941
- * @default false
942
- */
943
- skipPrototype?: boolean | undefined;
944
- }
1144
+ export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
945
1145
  /**
946
1146
  * Returns `true` if there is deep strict equality between `val1` and `val2`.
947
1147
  * Otherwise, returns `false`.
@@ -950,7 +1150,7 @@ declare module "node:util" {
950
1150
  * equality.
951
1151
  * @since v9.0.0
952
1152
  */
953
- export function isDeepStrictEqual(val1: unknown, val2: unknown, options?: IsDeepStrictEqualOptions): boolean;
1153
+ export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
954
1154
  /**
955
1155
  * Returns `str` with any ANSI escape codes removed.
956
1156
  *
@@ -1125,7 +1325,7 @@ declare module "node:util" {
1125
1325
  * ```
1126
1326
  *
1127
1327
  * If there is an `original[util.promisify.custom]` property present, `promisify`
1128
- * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v25.x/api/util.html#custom-promisified-functions).
1328
+ * will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v22.x/api/util.html#custom-promisified-functions).
1129
1329
  *
1130
1330
  * `promisify()` assumes that `original` is a function taking a callback as its
1131
1331
  * final argument in all cases. If `original` is not a function, `promisify()`
@@ -1216,19 +1416,74 @@ declare module "node:util" {
1216
1416
  * @since v20.12.0
1217
1417
  */
1218
1418
  export function parseEnv(content: string): NodeJS.Dict<string>;
1219
- export interface StyleTextOptions {
1220
- /**
1221
- * When true, `stream` is checked to see if it can handle colors.
1222
- * @default true
1223
- */
1224
- validateStream?: boolean | undefined;
1225
- /**
1226
- * A stream that will be validated if it can be colored.
1227
- * @default process.stdout
1228
- */
1229
- stream?: NodeJS.WritableStream | undefined;
1230
- }
1231
- /**
1419
+ // https://nodejs.org/docs/latest/api/util.html#foreground-colors
1420
+ type ForegroundColors =
1421
+ | "black"
1422
+ | "blackBright"
1423
+ | "blue"
1424
+ | "blueBright"
1425
+ | "cyan"
1426
+ | "cyanBright"
1427
+ | "gray"
1428
+ | "green"
1429
+ | "greenBright"
1430
+ | "grey"
1431
+ | "magenta"
1432
+ | "magentaBright"
1433
+ | "red"
1434
+ | "redBright"
1435
+ | "white"
1436
+ | "whiteBright"
1437
+ | "yellow"
1438
+ | "yellowBright";
1439
+ // https://nodejs.org/docs/latest/api/util.html#background-colors
1440
+ type BackgroundColors =
1441
+ | "bgBlack"
1442
+ | "bgBlackBright"
1443
+ | "bgBlue"
1444
+ | "bgBlueBright"
1445
+ | "bgCyan"
1446
+ | "bgCyanBright"
1447
+ | "bgGray"
1448
+ | "bgGreen"
1449
+ | "bgGreenBright"
1450
+ | "bgGrey"
1451
+ | "bgMagenta"
1452
+ | "bgMagentaBright"
1453
+ | "bgRed"
1454
+ | "bgRedBright"
1455
+ | "bgWhite"
1456
+ | "bgWhiteBright"
1457
+ | "bgYellow"
1458
+ | "bgYellowBright";
1459
+ // https://nodejs.org/docs/latest/api/util.html#modifiers
1460
+ type Modifiers =
1461
+ | "blink"
1462
+ | "bold"
1463
+ | "dim"
1464
+ | "doubleunderline"
1465
+ | "framed"
1466
+ | "hidden"
1467
+ | "inverse"
1468
+ | "italic"
1469
+ | "none"
1470
+ | "overlined"
1471
+ | "reset"
1472
+ | "strikethrough"
1473
+ | "underline";
1474
+ export interface StyleTextOptions {
1475
+ /**
1476
+ * When true, `stream` is checked to see if it can handle colors.
1477
+ * @default true
1478
+ */
1479
+ validateStream?: boolean | undefined;
1480
+ /**
1481
+ * A stream that will be validated if it can be colored.
1482
+ * @default process.stdout
1483
+ */
1484
+ stream?: NodeJS.WritableStream | undefined;
1485
+ }
1486
+ /**
1232
1487
  * This function returns a formatted text considering the `format` passed
1233
1488
  * for printing in a terminal. It is aware of the terminal's capabilities
1234
1489
  * and acts according to the configuration set via `NO_COLOR`,
@@ -1270,19 +1525,142 @@ declare module "node:util" {
1270
1525
  *
1271
1526
  * The special format value `none` applies no additional styling to the text.
1272
1527
  *
1273
- * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v25.x/api/util.html#modifiers).
1528
+ * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers).
1274
1529
  * @param format A text format or an Array of text formats defined in `util.inspect.colors`.
1275
1530
  * @param text The text to to be formatted.
1276
1531
  * @since v20.12.0
1277
1532
  */
1278
1533
  export function styleText(
1279
- format: InspectColor | readonly InspectColor[],
1534
+ format:
1535
+ | ForegroundColors
1536
+ | BackgroundColors
1537
+ | Modifiers
1538
+ | Array<ForegroundColors | BackgroundColors | Modifiers>,
1280
1539
  text: string,
1281
1540
  options?: StyleTextOptions,
1282
1541
  ): string;
1283
- /** @deprecated This alias will be removed in a future version. Use the canonical `TextEncoderEncodeIntoResult` instead. */
1284
- // TODO: remove in future major
1285
- export interface EncodeIntoResult extends TextEncoderEncodeIntoResult {}
1542
+ /**
1543
+ * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
1544
+ *
1545
+ * ```js
1546
+ * const decoder = new TextDecoder();
1547
+ * const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
1548
+ * console.log(decoder.decode(u8arr)); // Hello
1549
+ * ```
1550
+ * @since v8.3.0
1551
+ */
1552
+ export class TextDecoder {
1553
+ /**
1554
+ * The encoding supported by the `TextDecoder` instance.
1555
+ */
1556
+ readonly encoding: string;
1557
+ /**
1558
+ * The value will be `true` if decoding errors result in a `TypeError` being
1559
+ * thrown.
1560
+ */
1561
+ readonly fatal: boolean;
1562
+ /**
1563
+ * The value will be `true` if the decoding result will include the byte order
1564
+ * mark.
1565
+ */
1566
+ readonly ignoreBOM: boolean;
1567
+ constructor(
1568
+ encoding?: string,
1569
+ options?: {
1570
+ fatal?: boolean | undefined;
1571
+ ignoreBOM?: boolean | undefined;
1572
+ },
1573
+ );
1574
+ /**
1575
+ * Decodes the `input` and returns a string. If `options.stream` is `true`, any
1576
+ * incomplete byte sequences occurring at the end of the `input` are buffered
1577
+ * internally and emitted after the next call to `textDecoder.decode()`.
1578
+ *
1579
+ * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown.
1580
+ * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data.
1581
+ */
1582
+ decode(
1583
+ input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
1584
+ options?: {
1585
+ stream?: boolean | undefined;
1586
+ },
1587
+ ): string;
1588
+ }
1589
+ export interface EncodeIntoResult {
1590
+ /**
1591
+ * The read Unicode code units of input.
1592
+ */
1593
+ read: number;
1594
+ /**
1595
+ * The written UTF-8 bytes of output.
1596
+ */
1597
+ written: number;
1598
+ }
1599
+ export { types };
1600
+
1601
+ //// TextEncoder/Decoder
1602
+ /**
1603
+ * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
1604
+ * instances of `TextEncoder` only support UTF-8 encoding.
1605
+ *
1606
+ * ```js
1607
+ * const encoder = new TextEncoder();
1608
+ * const uint8array = encoder.encode('this is some data');
1609
+ * ```
1610
+ *
1611
+ * The `TextEncoder` class is also available on the global object.
1612
+ * @since v8.3.0
1613
+ */
1614
+ export class TextEncoder {
1615
+ /**
1616
+ * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
1617
+ */
1618
+ readonly encoding: string;
1619
+ /**
1620
+ * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
1621
+ * encoded bytes.
1622
+ * @param [input='an empty string'] The text to encode.
1623
+ */
1624
+ encode(input?: string): NodeJS.NonSharedUint8Array;
1625
+ /**
1626
+ * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
1627
+ * containing the read Unicode code units and written UTF-8 bytes.
1628
+ *
1629
+ * ```js
1630
+ * const encoder = new TextEncoder();
1631
+ * const src = 'this is some data';
1632
+ * const dest = new Uint8Array(10);
1633
+ * const { read, written } = encoder.encodeInto(src, dest);
1634
+ * ```
1635
+ * @param src The text to encode.
1636
+ * @param dest The array to hold the encode result.
1637
+ */
1638
+ encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1639
+ }
1640
+ import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
1641
+ global {
1642
+ /**
1643
+ * `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
1644
+ * https://nodejs.org/api/globals.html#textdecoder
1645
+ * @since v11.0.0
1646
+ */
1647
+ var TextDecoder: typeof globalThis extends {
1648
+ onmessage: any;
1649
+ TextDecoder: infer TextDecoder;
1650
+ } ? TextDecoder
1651
+ : typeof _TextDecoder;
1652
+ /**
1653
+ * `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
1654
+ * https://nodejs.org/api/globals.html#textencoder
1655
+ * @since v11.0.0
1656
+ */
1657
+ var TextEncoder: typeof globalThis extends {
1658
+ onmessage: any;
1659
+ TextEncoder: infer TextEncoder;
1660
+ } ? TextEncoder
1661
+ : typeof _TextEncoder;
1662
+ }
1663
+
1286
1664
  //// parseArgs
1287
1665
  /**
1288
1666
  * Provides a higher level API for command-line argument parsing than interacting
@@ -1313,10 +1691,12 @@ declare module "node:util" {
1313
1691
  * @return The parsed command line arguments:
1314
1692
  */
1315
1693
  export function parseArgs<T extends ParseArgsConfig>(config?: T): ParsedResults<T>;
1694
+
1316
1695
  /**
1317
1696
  * Type of argument used in {@link parseArgs}.
1318
1697
  */
1319
1698
  export type ParseArgsOptionsType = "boolean" | "string";
1699
+
1320
1700
  export interface ParseArgsOptionDescriptor {
1321
1701
  /**
1322
1702
  * Type of argument.
@@ -1391,19 +1771,23 @@ declare module "node:util" {
1391
1771
  type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true ? IfTrue
1392
1772
  : T extends false ? IfFalse
1393
1773
  : IfTrue;
1774
+
1394
1775
  // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
1395
1776
  type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false ? IfFalse
1396
1777
  : T extends true ? IfTrue
1397
1778
  : IfFalse;
1779
+
1398
1780
  type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionDescriptor> = IfDefaultsTrue<
1399
1781
  T["strict"],
1400
1782
  O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean,
1401
1783
  string | boolean
1402
1784
  >;
1785
+
1403
1786
  type ApplyOptionalModifiers<O extends ParseArgsOptionsConfig, V extends Record<keyof O, unknown>> = (
1404
1787
  & { -readonly [LongOption in keyof O]?: V[LongOption] }
1405
1788
  & { [LongOption in keyof O as O[LongOption]["default"] extends {} ? LongOption : never]: V[LongOption] }
1406
1789
  ) extends infer P ? { [K in keyof P]: P[K] } : never; // resolve intersection to object
1790
+
1407
1791
  type ParsedValues<T extends ParseArgsConfig> =
1408
1792
  & IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
1409
1793
  & (T["options"] extends ParseArgsOptionsConfig ? ApplyOptionalModifiers<
@@ -1417,11 +1801,13 @@ declare module "node:util" {
1417
1801
  }
1418
1802
  >
1419
1803
  : {});
1804
+
1420
1805
  type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
1421
1806
  T["strict"],
1422
1807
  IfDefaultsFalse<T["allowPositionals"], string[], []>,
1423
1808
  IfDefaultsTrue<T["allowPositionals"], string[], []>
1424
1809
  >;
1810
+
1425
1811
  type PreciseTokenForOptions<
1426
1812
  K extends string,
1427
1813
  O extends ParseArgsOptionDescriptor,
@@ -1442,6 +1828,7 @@ declare module "node:util" {
1442
1828
  inlineValue: undefined;
1443
1829
  }
1444
1830
  : OptionToken & { name: K };
1831
+
1445
1832
  type TokenForOptions<
1446
1833
  T extends ParseArgsConfig,
1447
1834
  K extends keyof T["options"] = keyof T["options"],
@@ -1449,15 +1836,19 @@ declare module "node:util" {
1449
1836
  ? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions<K & string, T["options"][K]>
1450
1837
  : OptionToken
1451
1838
  : never;
1839
+
1452
1840
  type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T["strict"], TokenForOptions<T>, OptionToken>;
1841
+
1453
1842
  type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
1454
1843
  T["strict"],
1455
1844
  IfDefaultsFalse<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>,
1456
1845
  IfDefaultsTrue<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>
1457
1846
  >;
1847
+
1458
1848
  type ParsedTokens<T extends ParseArgsConfig> = Array<
1459
1849
  ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: "option-terminator"; index: number }
1460
1850
  >;
1851
+
1461
1852
  type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
1462
1853
  T["tokens"],
1463
1854
  {
@@ -1470,6 +1861,7 @@ declare module "node:util" {
1470
1861
  positionals: ParsedPositionals<T>;
1471
1862
  }
1472
1863
  >;
1864
+
1473
1865
  type OptionToken =
1474
1866
  | { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
1475
1867
  | {
@@ -1480,10 +1872,12 @@ declare module "node:util" {
1480
1872
  value: undefined;
1481
1873
  inlineValue: undefined;
1482
1874
  };
1875
+
1483
1876
  type Token =
1484
1877
  | OptionToken
1485
1878
  | { kind: "positional"; index: number; value: string }
1486
1879
  | { kind: "option-terminator"; index: number };
1880
+
1487
1881
  // If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
1488
1882
  // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
1489
1883
  type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T ? {
@@ -1494,6 +1888,7 @@ declare module "node:util" {
1494
1888
  tokens?: Token[];
1495
1889
  }
1496
1890
  : PreciseParsedResults<T>;
1891
+
1497
1892
  /**
1498
1893
  * An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/).
1499
1894
  *
@@ -1515,6 +1910,7 @@ declare module "node:util" {
1515
1910
  * @param input The input MIME to parse.
1516
1911
  */
1517
1912
  constructor(input: string | { toString: () => string });
1913
+
1518
1914
  /**
1519
1915
  * Gets and sets the type portion of the MIME.
1520
1916
  *
@@ -1645,43 +2041,566 @@ declare module "node:util" {
1645
2041
  */
1646
2042
  [Symbol.iterator](): NodeJS.Iterator<[name: string, value: string]>;
1647
2043
  }
1648
- // #region web types
1649
- export interface TextDecodeOptions {
1650
- stream?: boolean;
1651
- }
1652
- export interface TextDecoderCommon {
1653
- readonly encoding: string;
1654
- readonly fatal: boolean;
1655
- readonly ignoreBOM: boolean;
1656
- }
1657
- export interface TextDecoderOptions {
1658
- fatal?: boolean;
1659
- ignoreBOM?: boolean;
1660
- }
1661
- export interface TextEncoderCommon {
1662
- readonly encoding: string;
1663
- }
1664
- export interface TextEncoderEncodeIntoResult {
1665
- read: number;
1666
- written: number;
1667
- }
1668
- export interface TextDecoder extends TextDecoderCommon {
1669
- decode(input?: NodeJS.AllowSharedBufferSource, options?: TextDecodeOptions): string;
1670
- }
1671
- export var TextDecoder: {
1672
- prototype: TextDecoder;
1673
- new(label?: string, options?: TextDecoderOptions): TextDecoder;
1674
- };
1675
- export interface TextEncoder extends TextEncoderCommon {
1676
- encode(input?: string): NodeJS.NonSharedUint8Array;
1677
- encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
1678
- }
1679
- export var TextEncoder: {
1680
- prototype: TextEncoder;
1681
- new(): TextEncoder;
1682
- };
1683
- // #endregion
1684
2044
  }
1685
- declare module "util" {
1686
- export * from "node:util";
2045
+ declare module "util/types" {
2046
+ import { KeyObject, webcrypto } from "node:crypto";
2047
+ /**
2048
+ * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
2049
+ * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
2050
+ *
2051
+ * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
2052
+ *
2053
+ * ```js
2054
+ * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
2055
+ * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
2056
+ * ```
2057
+ * @since v10.0.0
2058
+ */
2059
+ function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
2060
+ /**
2061
+ * Returns `true` if the value is an `arguments` object.
2062
+ *
2063
+ * ```js
2064
+ * function foo() {
2065
+ * util.types.isArgumentsObject(arguments); // Returns true
2066
+ * }
2067
+ * ```
2068
+ * @since v10.0.0
2069
+ */
2070
+ function isArgumentsObject(object: unknown): object is IArguments;
2071
+ /**
2072
+ * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
2073
+ * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
2074
+ * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
2075
+ *
2076
+ * ```js
2077
+ * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
2078
+ * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
2079
+ * ```
2080
+ * @since v10.0.0
2081
+ */
2082
+ function isArrayBuffer(object: unknown): object is ArrayBuffer;
2083
+ /**
2084
+ * Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed
2085
+ * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
2086
+ * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
2087
+ *
2088
+ * ```js
2089
+ * util.types.isArrayBufferView(new Int8Array()); // true
2090
+ * util.types.isArrayBufferView(Buffer.from('hello world')); // true
2091
+ * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
2092
+ * util.types.isArrayBufferView(new ArrayBuffer()); // false
2093
+ * ```
2094
+ * @since v10.0.0
2095
+ */
2096
+ function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
2097
+ /**
2098
+ * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
2099
+ * This only reports back what the JavaScript engine is seeing;
2100
+ * in particular, the return value may not match the original source code if
2101
+ * a transpilation tool was used.
2102
+ *
2103
+ * ```js
2104
+ * util.types.isAsyncFunction(function foo() {}); // Returns false
2105
+ * util.types.isAsyncFunction(async function foo() {}); // Returns true
2106
+ * ```
2107
+ * @since v10.0.0
2108
+ */
2109
+ function isAsyncFunction(object: unknown): boolean;
2110
+ /**
2111
+ * Returns `true` if the value is a `BigInt64Array` instance.
2112
+ *
2113
+ * ```js
2114
+ * util.types.isBigInt64Array(new BigInt64Array()); // Returns true
2115
+ * util.types.isBigInt64Array(new BigUint64Array()); // Returns false
2116
+ * ```
2117
+ * @since v10.0.0
2118
+ */
2119
+ function isBigInt64Array(value: unknown): value is BigInt64Array;
2120
+ /**
2121
+ * Returns `true` if the value is a BigInt object, e.g. created
2122
+ * by `Object(BigInt(123))`.
2123
+ *
2124
+ * ```js
2125
+ * util.types.isBigIntObject(Object(BigInt(123))); // Returns true
2126
+ * util.types.isBigIntObject(BigInt(123)); // Returns false
2127
+ * util.types.isBigIntObject(123); // Returns false
2128
+ * ```
2129
+ * @since v10.4.0
2130
+ */
2131
+ function isBigIntObject(object: unknown): object is BigInt;
2132
+ /**
2133
+ * Returns `true` if the value is a `BigUint64Array` instance.
2134
+ *
2135
+ * ```js
2136
+ * util.types.isBigUint64Array(new BigInt64Array()); // Returns false
2137
+ * util.types.isBigUint64Array(new BigUint64Array()); // Returns true
2138
+ * ```
2139
+ * @since v10.0.0
2140
+ */
2141
+ function isBigUint64Array(value: unknown): value is BigUint64Array;
2142
+ /**
2143
+ * Returns `true` if the value is a boolean object, e.g. created
2144
+ * by `new Boolean()`.
2145
+ *
2146
+ * ```js
2147
+ * util.types.isBooleanObject(false); // Returns false
2148
+ * util.types.isBooleanObject(true); // Returns false
2149
+ * util.types.isBooleanObject(new Boolean(false)); // Returns true
2150
+ * util.types.isBooleanObject(new Boolean(true)); // Returns true
2151
+ * util.types.isBooleanObject(Boolean(false)); // Returns false
2152
+ * util.types.isBooleanObject(Boolean(true)); // Returns false
2153
+ * ```
2154
+ * @since v10.0.0
2155
+ */
2156
+ function isBooleanObject(object: unknown): object is Boolean;
2157
+ /**
2158
+ * Returns `true` if the value is any boxed primitive object, e.g. created
2159
+ * by `new Boolean()`, `new String()` or `Object(Symbol())`.
2160
+ *
2161
+ * For example:
2162
+ *
2163
+ * ```js
2164
+ * util.types.isBoxedPrimitive(false); // Returns false
2165
+ * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
2166
+ * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
2167
+ * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
2168
+ * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
2169
+ * ```
2170
+ * @since v10.11.0
2171
+ */
2172
+ function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
2173
+ /**
2174
+ * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
2175
+ *
2176
+ * ```js
2177
+ * const ab = new ArrayBuffer(20);
2178
+ * util.types.isDataView(new DataView(ab)); // Returns true
2179
+ * util.types.isDataView(new Float64Array()); // Returns false
2180
+ * ```
2181
+ *
2182
+ * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
2183
+ * @since v10.0.0
2184
+ */
2185
+ function isDataView(object: unknown): object is DataView;
2186
+ /**
2187
+ * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
2188
+ *
2189
+ * ```js
2190
+ * util.types.isDate(new Date()); // Returns true
2191
+ * ```
2192
+ * @since v10.0.0
2193
+ */
2194
+ function isDate(object: unknown): object is Date;
2195
+ /**
2196
+ * Returns `true` if the value is a native `External` value.
2197
+ *
2198
+ * A native `External` value is a special type of object that contains a
2199
+ * raw C++ pointer (`void*`) for access from native code, and has no other
2200
+ * properties. Such objects are created either by Node.js internals or native
2201
+ * addons. In JavaScript, they are
2202
+ * [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a
2203
+ * `null` prototype.
2204
+ *
2205
+ * ```c
2206
+ * #include <js_native_api.h>
2207
+ * #include <stdlib.h>
2208
+ * napi_value result;
2209
+ * static napi_value MyNapi(napi_env env, napi_callback_info info) {
2210
+ * int* raw = (int*) malloc(1024);
2211
+ * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
2212
+ * if (status != napi_ok) {
2213
+ * napi_throw_error(env, NULL, "napi_create_external failed");
2214
+ * return NULL;
2215
+ * }
2216
+ * return result;
2217
+ * }
2218
+ * ...
2219
+ * DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
2220
+ * ...
2221
+ * ```
2222
+ *
2223
+ * ```js
2224
+ * import native from 'napi_addon.node';
2225
+ * import { types } from 'node:util';
2226
+ *
2227
+ * const data = native.myNapi();
2228
+ * types.isExternal(data); // returns true
2229
+ * types.isExternal(0); // returns false
2230
+ * types.isExternal(new String('foo')); // returns false
2231
+ * ```
2232
+ *
2233
+ * For further information on `napi_create_external`, refer to
2234
+ * [`napi_create_external()`](https://nodejs.org/docs/latest-v22.x/api/n-api.html#napi_create_external).
2235
+ * @since v10.0.0
2236
+ */
2237
+ function isExternal(object: unknown): boolean;
2238
+ /**
2239
+ * Returns `true` if the value is a built-in `Float16Array` instance.
2240
+ *
2241
+ * ```js
2242
+ * util.types.isFloat16Array(new ArrayBuffer()); // Returns false
2243
+ * util.types.isFloat16Array(new Float16Array()); // Returns true
2244
+ * util.types.isFloat16Array(new Float32Array()); // Returns false
2245
+ * ```
2246
+ * @since v22.16.0
2247
+ */
2248
+ // This does NOT return a type predicate in v22.x.
2249
+ // The Float16Array feature does not yet exist in this version of Node.js.
2250
+ function isFloat16Array(object: unknown): boolean;
2251
+ /**
2252
+ * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
2253
+ *
2254
+ * ```js
2255
+ * util.types.isFloat32Array(new ArrayBuffer()); // Returns false
2256
+ * util.types.isFloat32Array(new Float32Array()); // Returns true
2257
+ * util.types.isFloat32Array(new Float64Array()); // Returns false
2258
+ * ```
2259
+ * @since v10.0.0
2260
+ */
2261
+ function isFloat32Array(object: unknown): object is Float32Array;
2262
+ /**
2263
+ * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
2264
+ *
2265
+ * ```js
2266
+ * util.types.isFloat64Array(new ArrayBuffer()); // Returns false
2267
+ * util.types.isFloat64Array(new Uint8Array()); // Returns false
2268
+ * util.types.isFloat64Array(new Float64Array()); // Returns true
2269
+ * ```
2270
+ * @since v10.0.0
2271
+ */
2272
+ function isFloat64Array(object: unknown): object is Float64Array;
2273
+ /**
2274
+ * Returns `true` if the value is a generator function.
2275
+ * This only reports back what the JavaScript engine is seeing;
2276
+ * in particular, the return value may not match the original source code if
2277
+ * a transpilation tool was used.
2278
+ *
2279
+ * ```js
2280
+ * util.types.isGeneratorFunction(function foo() {}); // Returns false
2281
+ * util.types.isGeneratorFunction(function* foo() {}); // Returns true
2282
+ * ```
2283
+ * @since v10.0.0
2284
+ */
2285
+ function isGeneratorFunction(object: unknown): object is GeneratorFunction;
2286
+ /**
2287
+ * Returns `true` if the value is a generator object as returned from a
2288
+ * built-in generator function.
2289
+ * This only reports back what the JavaScript engine is seeing;
2290
+ * in particular, the return value may not match the original source code if
2291
+ * a transpilation tool was used.
2292
+ *
2293
+ * ```js
2294
+ * function* foo() {}
2295
+ * const generator = foo();
2296
+ * util.types.isGeneratorObject(generator); // Returns true
2297
+ * ```
2298
+ * @since v10.0.0
2299
+ */
2300
+ function isGeneratorObject(object: unknown): object is Generator;
2301
+ /**
2302
+ * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
2303
+ *
2304
+ * ```js
2305
+ * util.types.isInt8Array(new ArrayBuffer()); // Returns false
2306
+ * util.types.isInt8Array(new Int8Array()); // Returns true
2307
+ * util.types.isInt8Array(new Float64Array()); // Returns false
2308
+ * ```
2309
+ * @since v10.0.0
2310
+ */
2311
+ function isInt8Array(object: unknown): object is Int8Array;
2312
+ /**
2313
+ * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
2314
+ *
2315
+ * ```js
2316
+ * util.types.isInt16Array(new ArrayBuffer()); // Returns false
2317
+ * util.types.isInt16Array(new Int16Array()); // Returns true
2318
+ * util.types.isInt16Array(new Float64Array()); // Returns false
2319
+ * ```
2320
+ * @since v10.0.0
2321
+ */
2322
+ function isInt16Array(object: unknown): object is Int16Array;
2323
+ /**
2324
+ * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
2325
+ *
2326
+ * ```js
2327
+ * util.types.isInt32Array(new ArrayBuffer()); // Returns false
2328
+ * util.types.isInt32Array(new Int32Array()); // Returns true
2329
+ * util.types.isInt32Array(new Float64Array()); // Returns false
2330
+ * ```
2331
+ * @since v10.0.0
2332
+ */
2333
+ function isInt32Array(object: unknown): object is Int32Array;
2334
+ /**
2335
+ * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
2336
+ *
2337
+ * ```js
2338
+ * util.types.isMap(new Map()); // Returns true
2339
+ * ```
2340
+ * @since v10.0.0
2341
+ */
2342
+ function isMap<T>(
2343
+ object: T | {},
2344
+ ): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>)
2345
+ : Map<unknown, unknown>;
2346
+ /**
2347
+ * Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
2348
+ *
2349
+ * ```js
2350
+ * const map = new Map();
2351
+ * util.types.isMapIterator(map.keys()); // Returns true
2352
+ * util.types.isMapIterator(map.values()); // Returns true
2353
+ * util.types.isMapIterator(map.entries()); // Returns true
2354
+ * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
2355
+ * ```
2356
+ * @since v10.0.0
2357
+ */
2358
+ function isMapIterator(object: unknown): boolean;
2359
+ /**
2360
+ * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
2361
+ *
2362
+ * ```js
2363
+ * import * as ns from './a.js';
2364
+ *
2365
+ * util.types.isModuleNamespaceObject(ns); // Returns true
2366
+ * ```
2367
+ * @since v10.0.0
2368
+ */
2369
+ function isModuleNamespaceObject(value: unknown): boolean;
2370
+ /**
2371
+ * Returns `true` if the value was returned by the constructor of a
2372
+ * [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
2373
+ *
2374
+ * ```js
2375
+ * console.log(util.types.isNativeError(new Error())); // true
2376
+ * console.log(util.types.isNativeError(new TypeError())); // true
2377
+ * console.log(util.types.isNativeError(new RangeError())); // true
2378
+ * ```
2379
+ *
2380
+ * Subclasses of the native error types are also native errors:
2381
+ *
2382
+ * ```js
2383
+ * class MyError extends Error {}
2384
+ * console.log(util.types.isNativeError(new MyError())); // true
2385
+ * ```
2386
+ *
2387
+ * A value being `instanceof` a native error class is not equivalent to `isNativeError()`
2388
+ * returning `true` for that value. `isNativeError()` returns `true` for errors
2389
+ * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`
2390
+ * for these errors:
2391
+ *
2392
+ * ```js
2393
+ * import { createContext, runInContext } from 'node:vm';
2394
+ * import { types } from 'node:util';
2395
+ *
2396
+ * const context = createContext({});
2397
+ * const myError = runInContext('new Error()', context);
2398
+ * console.log(types.isNativeError(myError)); // true
2399
+ * console.log(myError instanceof Error); // false
2400
+ * ```
2401
+ *
2402
+ * Conversely, `isNativeError()` returns `false` for all objects which were not
2403
+ * returned by the constructor of a native error. That includes values
2404
+ * which are `instanceof` native errors:
2405
+ *
2406
+ * ```js
2407
+ * const myError = { __proto__: Error.prototype };
2408
+ * console.log(util.types.isNativeError(myError)); // false
2409
+ * console.log(myError instanceof Error); // true
2410
+ * ```
2411
+ * @since v10.0.0
2412
+ */
2413
+ function isNativeError(object: unknown): object is Error;
2414
+ /**
2415
+ * Returns `true` if the value is a number object, e.g. created
2416
+ * by `new Number()`.
2417
+ *
2418
+ * ```js
2419
+ * util.types.isNumberObject(0); // Returns false
2420
+ * util.types.isNumberObject(new Number(0)); // Returns true
2421
+ * ```
2422
+ * @since v10.0.0
2423
+ */
2424
+ function isNumberObject(object: unknown): object is Number;
2425
+ /**
2426
+ * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
2427
+ *
2428
+ * ```js
2429
+ * util.types.isPromise(Promise.resolve(42)); // Returns true
2430
+ * ```
2431
+ * @since v10.0.0
2432
+ */
2433
+ function isPromise(object: unknown): object is Promise<unknown>;
2434
+ /**
2435
+ * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
2436
+ *
2437
+ * ```js
2438
+ * const target = {};
2439
+ * const proxy = new Proxy(target, {});
2440
+ * util.types.isProxy(target); // Returns false
2441
+ * util.types.isProxy(proxy); // Returns true
2442
+ * ```
2443
+ * @since v10.0.0
2444
+ */
2445
+ function isProxy(object: unknown): boolean;
2446
+ /**
2447
+ * Returns `true` if the value is a regular expression object.
2448
+ *
2449
+ * ```js
2450
+ * util.types.isRegExp(/abc/); // Returns true
2451
+ * util.types.isRegExp(new RegExp('abc')); // Returns true
2452
+ * ```
2453
+ * @since v10.0.0
2454
+ */
2455
+ function isRegExp(object: unknown): object is RegExp;
2456
+ /**
2457
+ * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
2458
+ *
2459
+ * ```js
2460
+ * util.types.isSet(new Set()); // Returns true
2461
+ * ```
2462
+ * @since v10.0.0
2463
+ */
2464
+ function isSet<T>(
2465
+ object: T | {},
2466
+ ): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
2467
+ /**
2468
+ * Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
2469
+ *
2470
+ * ```js
2471
+ * const set = new Set();
2472
+ * util.types.isSetIterator(set.keys()); // Returns true
2473
+ * util.types.isSetIterator(set.values()); // Returns true
2474
+ * util.types.isSetIterator(set.entries()); // Returns true
2475
+ * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
2476
+ * ```
2477
+ * @since v10.0.0
2478
+ */
2479
+ function isSetIterator(object: unknown): boolean;
2480
+ /**
2481
+ * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
2482
+ * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
2483
+ * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
2484
+ *
2485
+ * ```js
2486
+ * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
2487
+ * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
2488
+ * ```
2489
+ * @since v10.0.0
2490
+ */
2491
+ function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
2492
+ /**
2493
+ * Returns `true` if the value is a string object, e.g. created
2494
+ * by `new String()`.
2495
+ *
2496
+ * ```js
2497
+ * util.types.isStringObject('foo'); // Returns false
2498
+ * util.types.isStringObject(new String('foo')); // Returns true
2499
+ * ```
2500
+ * @since v10.0.0
2501
+ */
2502
+ function isStringObject(object: unknown): object is String;
2503
+ /**
2504
+ * Returns `true` if the value is a symbol object, created
2505
+ * by calling `Object()` on a `Symbol` primitive.
2506
+ *
2507
+ * ```js
2508
+ * const symbol = Symbol('foo');
2509
+ * util.types.isSymbolObject(symbol); // Returns false
2510
+ * util.types.isSymbolObject(Object(symbol)); // Returns true
2511
+ * ```
2512
+ * @since v10.0.0
2513
+ */
2514
+ function isSymbolObject(object: unknown): object is Symbol;
2515
+ /**
2516
+ * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
2517
+ *
2518
+ * ```js
2519
+ * util.types.isTypedArray(new ArrayBuffer()); // Returns false
2520
+ * util.types.isTypedArray(new Uint8Array()); // Returns true
2521
+ * util.types.isTypedArray(new Float64Array()); // Returns true
2522
+ * ```
2523
+ *
2524
+ * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
2525
+ * @since v10.0.0
2526
+ */
2527
+ function isTypedArray(object: unknown): object is NodeJS.TypedArray;
2528
+ /**
2529
+ * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
2530
+ *
2531
+ * ```js
2532
+ * util.types.isUint8Array(new ArrayBuffer()); // Returns false
2533
+ * util.types.isUint8Array(new Uint8Array()); // Returns true
2534
+ * util.types.isUint8Array(new Float64Array()); // Returns false
2535
+ * ```
2536
+ * @since v10.0.0
2537
+ */
2538
+ function isUint8Array(object: unknown): object is Uint8Array;
2539
+ /**
2540
+ * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
2541
+ *
2542
+ * ```js
2543
+ * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
2544
+ * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
2545
+ * util.types.isUint8ClampedArray(new Float64Array()); // Returns false
2546
+ * ```
2547
+ * @since v10.0.0
2548
+ */
2549
+ function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
2550
+ /**
2551
+ * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
2552
+ *
2553
+ * ```js
2554
+ * util.types.isUint16Array(new ArrayBuffer()); // Returns false
2555
+ * util.types.isUint16Array(new Uint16Array()); // Returns true
2556
+ * util.types.isUint16Array(new Float64Array()); // Returns false
2557
+ * ```
2558
+ * @since v10.0.0
2559
+ */
2560
+ function isUint16Array(object: unknown): object is Uint16Array;
2561
+ /**
2562
+ * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
2563
+ *
2564
+ * ```js
2565
+ * util.types.isUint32Array(new ArrayBuffer()); // Returns false
2566
+ * util.types.isUint32Array(new Uint32Array()); // Returns true
2567
+ * util.types.isUint32Array(new Float64Array()); // Returns false
2568
+ * ```
2569
+ * @since v10.0.0
2570
+ */
2571
+ function isUint32Array(object: unknown): object is Uint32Array;
2572
+ /**
2573
+ * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
2574
+ *
2575
+ * ```js
2576
+ * util.types.isWeakMap(new WeakMap()); // Returns true
2577
+ * ```
2578
+ * @since v10.0.0
2579
+ */
2580
+ function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
2581
+ /**
2582
+ * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
2583
+ *
2584
+ * ```js
2585
+ * util.types.isWeakSet(new WeakSet()); // Returns true
2586
+ * ```
2587
+ * @since v10.0.0
2588
+ */
2589
+ function isWeakSet(object: unknown): object is WeakSet<object>;
2590
+ /**
2591
+ * Returns `true` if `value` is a `KeyObject`, `false` otherwise.
2592
+ * @since v16.2.0
2593
+ */
2594
+ function isKeyObject(object: unknown): object is KeyObject;
2595
+ /**
2596
+ * Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
2597
+ * @since v16.2.0
2598
+ */
2599
+ function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
2600
+ }
2601
+ declare module "node:util" {
2602
+ export * from "util";
2603
+ }
2604
+ declare module "node:util/types" {
2605
+ export * from "util/types";
1687
2606
  }