@types/node 22.15.21 → 24.10.1

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 (75) hide show
  1. node/README.md +2 -2
  2. node/assert/strict.d.ts +105 -2
  3. node/assert.d.ts +162 -101
  4. node/async_hooks.d.ts +26 -6
  5. node/buffer.buffer.d.ts +9 -0
  6. node/buffer.d.ts +15 -7
  7. node/child_process.d.ts +91 -164
  8. node/cluster.d.ts +19 -20
  9. node/console.d.ts +19 -18
  10. node/crypto.d.ts +1264 -356
  11. node/dgram.d.ts +10 -9
  12. node/diagnostics_channel.d.ts +18 -15
  13. node/dns/promises.d.ts +36 -9
  14. node/dns.d.ts +95 -37
  15. node/domain.d.ts +1 -1
  16. node/events.d.ts +81 -36
  17. node/fs/promises.d.ts +104 -59
  18. node/fs.d.ts +414 -137
  19. node/globals.d.ts +149 -350
  20. node/globals.typedarray.d.ts +20 -0
  21. node/http.d.ts +187 -37
  22. node/http2.d.ts +266 -67
  23. node/https.d.ts +97 -63
  24. node/index.d.ts +16 -7
  25. node/inspector.d.ts +206 -3931
  26. node/inspector.generated.d.ts +4233 -0
  27. node/module.d.ts +153 -31
  28. node/net.d.ts +35 -16
  29. node/os.d.ts +22 -10
  30. node/package.json +14 -84
  31. node/path.d.ts +1 -1
  32. node/perf_hooks.d.ts +30 -18
  33. node/process.d.ts +40 -34
  34. node/punycode.d.ts +1 -1
  35. node/querystring.d.ts +1 -1
  36. node/readline/promises.d.ts +1 -2
  37. node/readline.d.ts +13 -13
  38. node/repl.d.ts +25 -17
  39. node/sea.d.ts +10 -1
  40. node/sqlite.d.ts +438 -9
  41. node/stream/consumers.d.ts +2 -2
  42. node/stream/web.d.ts +13 -54
  43. node/stream.d.ts +68 -47
  44. node/string_decoder.d.ts +3 -3
  45. node/test.d.ts +2034 -1975
  46. node/timers/promises.d.ts +1 -1
  47. node/timers.d.ts +1 -3
  48. node/tls.d.ts +124 -114
  49. node/trace_events.d.ts +6 -6
  50. node/ts5.6/buffer.buffer.d.ts +10 -2
  51. node/ts5.6/compatibility/float16array.d.ts +71 -0
  52. node/ts5.6/globals.typedarray.d.ts +17 -0
  53. node/ts5.6/index.d.ts +18 -7
  54. node/ts5.7/compatibility/float16array.d.ts +72 -0
  55. node/ts5.7/index.d.ts +103 -0
  56. node/tty.d.ts +1 -1
  57. node/url.d.ts +119 -34
  58. node/util.d.ts +46 -305
  59. node/v8.d.ts +100 -37
  60. node/vm.d.ts +299 -110
  61. node/wasi.d.ts +23 -2
  62. node/web-globals/abortcontroller.d.ts +34 -0
  63. node/web-globals/crypto.d.ts +32 -0
  64. node/web-globals/domexception.d.ts +68 -0
  65. node/web-globals/events.d.ts +97 -0
  66. node/web-globals/fetch.d.ts +50 -0
  67. node/web-globals/navigator.d.ts +25 -0
  68. node/web-globals/storage.d.ts +24 -0
  69. node/web-globals/streams.d.ts +22 -0
  70. node/worker_threads.d.ts +225 -75
  71. node/zlib.d.ts +44 -33
  72. node/compatibility/disposable.d.ts +0 -16
  73. node/compatibility/index.d.ts +0 -9
  74. node/compatibility/indexable.d.ts +0 -23
  75. node/dom-events.d.ts +0 -124
node/worker_threads.d.ts CHANGED
@@ -15,28 +15,31 @@
15
15
  *
16
16
  * ```js
17
17
  * import {
18
- * Worker, isMainThread, parentPort, workerData,
18
+ * Worker,
19
+ * isMainThread,
20
+ * parentPort,
21
+ * workerData,
19
22
  * } from 'node:worker_threads';
20
- * import { parse } from 'some-js-parsing-library';
21
23
  *
22
- * if (isMainThread) {
23
- * module.exports = function parseJSAsync(script) {
24
- * return new Promise((resolve, reject) => {
25
- * const worker = new Worker(__filename, {
26
- * workerData: script,
27
- * });
28
- * worker.on('message', resolve);
29
- * worker.on('error', reject);
30
- * worker.on('exit', (code) => {
31
- * if (code !== 0)
32
- * reject(new Error(`Worker stopped with exit code ${code}`));
33
- * });
34
- * });
35
- * };
36
- * } else {
24
+ * if (!isMainThread) {
25
+ * const { parse } = await import('some-js-parsing-library');
37
26
  * const script = workerData;
38
27
  * parentPort.postMessage(parse(script));
39
28
  * }
29
+ *
30
+ * export default function parseJSAsync(script) {
31
+ * return new Promise((resolve, reject) => {
32
+ * const worker = new Worker(new URL(import.meta.url), {
33
+ * workerData: script,
34
+ * });
35
+ * worker.on('message', resolve);
36
+ * worker.on('error', reject);
37
+ * worker.on('exit', (code) => {
38
+ * if (code !== 0)
39
+ * reject(new Error(`Worker stopped with exit code ${code}`));
40
+ * });
41
+ * });
42
+ * };
40
43
  * ```
41
44
  *
42
45
  * The above example spawns a Worker thread for each `parseJSAsync()` call. In
@@ -49,23 +52,25 @@
49
52
  *
50
53
  * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
51
54
  * specifically `argv` and `execArgv` options.
52
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/worker_threads.js)
55
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/worker_threads.js)
53
56
  */
54
57
  declare module "worker_threads" {
55
- import { Blob } from "node:buffer";
56
58
  import { Context } from "node:vm";
57
- import { EventEmitter } from "node:events";
59
+ import { EventEmitter, NodeEventTarget } from "node:events";
58
60
  import { EventLoopUtilityFunction } from "node:perf_hooks";
59
61
  import { FileHandle } from "node:fs/promises";
60
62
  import { Readable, Writable } from "node:stream";
63
+ import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
61
64
  import { URL } from "node:url";
62
- import { X509Certificate } from "node:crypto";
65
+ import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
66
+ import { MessageEvent } from "undici-types";
63
67
  const isInternalThread: boolean;
64
68
  const isMainThread: boolean;
65
69
  const parentPort: null | MessagePort;
66
70
  const resourceLimits: ResourceLimits;
67
71
  const SHARE_ENV: unique symbol;
68
72
  const threadId: number;
73
+ const threadName: string | null;
69
74
  const workerData: any;
70
75
  /**
71
76
  * Instances of the `worker.MessageChannel` class represent an asynchronous,
@@ -89,7 +94,17 @@ declare module "worker_threads" {
89
94
  interface WorkerPerformance {
90
95
  eventLoopUtilization: EventLoopUtilityFunction;
91
96
  }
92
- type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
97
+ type Transferable =
98
+ | ArrayBuffer
99
+ | MessagePort
100
+ | AbortSignal
101
+ | FileHandle
102
+ | ReadableStream
103
+ | WritableStream
104
+ | TransformStream;
105
+ /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
106
+ // TODO: remove in a future major @types/node version.
107
+ type TransferListItem = Transferable;
93
108
  /**
94
109
  * Instances of the `worker.MessagePort` class represent one end of an
95
110
  * asynchronous, two-way communications channel. It can be used to transfer
@@ -98,7 +113,7 @@ declare module "worker_threads" {
98
113
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
99
114
  * @since v10.5.0
100
115
  */
101
- class MessagePort extends EventEmitter {
116
+ class MessagePort implements EventTarget {
102
117
  /**
103
118
  * Disables further sending of messages on either side of the connection.
104
119
  * This method can be called when no further communication will happen over this `MessagePort`.
@@ -174,7 +189,12 @@ declare module "worker_threads" {
174
189
  * behind this API, see the `serialization API of the node:v8 module`.
175
190
  * @since v10.5.0
176
191
  */
177
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
192
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
193
+ /**
194
+ * If true, the `MessagePort` object will keep the Node.js event loop active.
195
+ * @since v18.1.0, v16.17.0
196
+ */
197
+ hasRef(): boolean;
178
198
  /**
179
199
  * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
180
200
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -206,42 +226,32 @@ declare module "worker_threads" {
206
226
  * @since v10.5.0
207
227
  */
208
228
  start(): void;
209
- addListener(event: "close", listener: () => void): this;
229
+ addListener(event: "close", listener: (ev: Event) => void): this;
210
230
  addListener(event: "message", listener: (value: any) => void): this;
211
231
  addListener(event: "messageerror", listener: (error: Error) => void): this;
212
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
213
- emit(event: "close"): boolean;
232
+ addListener(event: string, listener: (arg: any) => void): this;
233
+ emit(event: "close", ev: Event): boolean;
214
234
  emit(event: "message", value: any): boolean;
215
235
  emit(event: "messageerror", error: Error): boolean;
216
- emit(event: string | symbol, ...args: any[]): boolean;
217
- on(event: "close", listener: () => void): this;
236
+ emit(event: string, arg: any): boolean;
237
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
238
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
239
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
240
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
241
+ on(event: "close", listener: (ev: Event) => void): this;
218
242
  on(event: "message", listener: (value: any) => void): this;
219
243
  on(event: "messageerror", listener: (error: Error) => void): this;
220
- on(event: string | symbol, listener: (...args: any[]) => void): this;
221
- once(event: "close", listener: () => void): this;
244
+ on(event: string, listener: (arg: any) => void): this;
245
+ once(event: "close", listener: (ev: Event) => void): this;
222
246
  once(event: "message", listener: (value: any) => void): this;
223
247
  once(event: "messageerror", listener: (error: Error) => void): this;
224
- once(event: string | symbol, listener: (...args: any[]) => void): this;
225
- prependListener(event: "close", listener: () => void): this;
226
- prependListener(event: "message", listener: (value: any) => void): this;
227
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
228
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
229
- prependOnceListener(event: "close", listener: () => void): this;
230
- prependOnceListener(event: "message", listener: (value: any) => void): this;
231
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
232
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
233
- removeListener(event: "close", listener: () => void): this;
234
- removeListener(event: "message", listener: (value: any) => void): this;
235
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
236
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
237
- off(event: "close", listener: () => void): this;
238
- off(event: "message", listener: (value: any) => void): this;
239
- off(event: "messageerror", listener: (error: Error) => void): this;
240
- off(event: string | symbol, listener: (...args: any[]) => void): this;
241
- addEventListener: EventTarget["addEventListener"];
242
- dispatchEvent: EventTarget["dispatchEvent"];
243
- removeEventListener: EventTarget["removeEventListener"];
248
+ once(event: string, listener: (arg: any) => void): this;
249
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
250
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
251
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
252
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
244
253
  }
254
+ interface MessagePort extends NodeEventTarget {}
245
255
  interface WorkerOptions {
246
256
  /**
247
257
  * List of arguments which would be stringified and appended to
@@ -261,7 +271,7 @@ declare module "worker_threads" {
261
271
  /**
262
272
  * Additional data to send in the first worker message.
263
273
  */
264
- transferList?: TransferListItem[] | undefined;
274
+ transferList?: Transferable[] | undefined;
265
275
  /**
266
276
  * @default true
267
277
  */
@@ -383,6 +393,12 @@ declare module "worker_threads" {
383
393
  * @since v10.5.0
384
394
  */
385
395
  readonly threadId: number;
396
+ /**
397
+ * A string identifier for the referenced thread or null if the thread is not running.
398
+ * Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
399
+ * @since v24.6.0
400
+ */
401
+ readonly threadName: string | null;
386
402
  /**
387
403
  * Provides the set of JS engine resource constraints for this Worker thread.
388
404
  * If the `resourceLimits` option was passed to the `Worker` constructor,
@@ -409,25 +425,7 @@ declare module "worker_threads" {
409
425
  * See `port.postMessage()` for more details.
410
426
  * @since v10.5.0
411
427
  */
412
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
413
- /**
414
- * Sends a value to another worker, identified by its thread ID.
415
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
416
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
417
- * @param value The value to send.
418
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
419
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
420
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
421
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
422
- * @since v22.5.0
423
- */
424
- postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
425
- postMessageToThread(
426
- threadId: number,
427
- value: any,
428
- transferList: readonly TransferListItem[],
429
- timeout?: number,
430
- ): Promise<void>;
428
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
431
429
  /**
432
430
  * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
433
431
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -447,6 +445,13 @@ declare module "worker_threads" {
447
445
  * @since v10.5.0
448
446
  */
449
447
  terminate(): Promise<number>;
448
+ /**
449
+ * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
450
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
451
+ * This methods allows the statistics to be observed from outside the actual thread.
452
+ * @since v24.6.0
453
+ */
454
+ cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
450
455
  /**
451
456
  * Returns a readable stream for a V8 snapshot of the current state of the Worker.
452
457
  * See `v8.getHeapSnapshot()` for more details.
@@ -457,6 +462,100 @@ declare module "worker_threads" {
457
462
  * @return A promise for a Readable Stream containing a V8 heap snapshot
458
463
  */
459
464
  getHeapSnapshot(): Promise<Readable>;
465
+ /**
466
+ * This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
467
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
468
+ * This methods allows the statistics to be observed from outside the actual thread.
469
+ * @since v24.0.0
470
+ */
471
+ getHeapStatistics(): Promise<HeapInfo>;
472
+ /**
473
+ * Starting a CPU profile then return a Promise that fulfills with an error
474
+ * or an `CPUProfileHandle` object. This API supports `await using` syntax.
475
+ *
476
+ * ```js
477
+ * const { Worker } = require('node:worker_threads');
478
+ *
479
+ * const worker = new Worker(`
480
+ * const { parentPort } = require('worker_threads');
481
+ * parentPort.on('message', () => {});
482
+ * `, { eval: true });
483
+ *
484
+ * worker.on('online', async () => {
485
+ * const handle = await worker.startCpuProfile();
486
+ * const profile = await handle.stop();
487
+ * console.log(profile);
488
+ * worker.terminate();
489
+ * });
490
+ * ```
491
+ *
492
+ * `await using` example.
493
+ *
494
+ * ```js
495
+ * const { Worker } = require('node:worker_threads');
496
+ *
497
+ * const w = new Worker(`
498
+ * const { parentPort } = require('node:worker_threads');
499
+ * parentPort.on('message', () => {});
500
+ * `, { eval: true });
501
+ *
502
+ * w.on('online', async () => {
503
+ * // Stop profile automatically when return and profile will be discarded
504
+ * await using handle = await w.startCpuProfile();
505
+ * });
506
+ * ```
507
+ * @since v24.8.0
508
+ */
509
+ startCpuProfile(): Promise<CPUProfileHandle>;
510
+ /**
511
+ * Starting a Heap profile then return a Promise that fulfills with an error
512
+ * or an `HeapProfileHandle` object. This API supports `await using` syntax.
513
+ *
514
+ * ```js
515
+ * const { Worker } = require('node:worker_threads');
516
+ *
517
+ * const worker = new Worker(`
518
+ * const { parentPort } = require('worker_threads');
519
+ * parentPort.on('message', () => {});
520
+ * `, { eval: true });
521
+ *
522
+ * worker.on('online', async () => {
523
+ * const handle = await worker.startHeapProfile();
524
+ * const profile = await handle.stop();
525
+ * console.log(profile);
526
+ * worker.terminate();
527
+ * });
528
+ * ```
529
+ *
530
+ * `await using` example.
531
+ *
532
+ * ```js
533
+ * const { Worker } = require('node:worker_threads');
534
+ *
535
+ * const w = new Worker(`
536
+ * const { parentPort } = require('node:worker_threads');
537
+ * parentPort.on('message', () => {});
538
+ * `, { eval: true });
539
+ *
540
+ * w.on('online', async () => {
541
+ * // Stop profile automatically when return and profile will be discarded
542
+ * await using handle = await w.startHeapProfile();
543
+ * });
544
+ * ```
545
+ */
546
+ startHeapProfile(): Promise<HeapProfileHandle>;
547
+ /**
548
+ * Calls `worker.terminate()` when the dispose scope is exited.
549
+ *
550
+ * ```js
551
+ * async function example() {
552
+ * await using worker = new Worker('for (;;) {}', { eval: true });
553
+ * // Worker is automatically terminate when the scope is exited.
554
+ * }
555
+ * ```
556
+ * @since v24.2.0
557
+ */
558
+ [Symbol.asyncDispose](): Promise<void>;
460
559
  addListener(event: "error", listener: (err: Error) => void): this;
461
560
  addListener(event: "exit", listener: (exitCode: number) => void): this;
462
561
  addListener(event: "message", listener: (value: any) => void): this;
@@ -537,18 +636,18 @@ declare module "worker_threads" {
537
636
  * ```
538
637
  * @since v15.4.0
539
638
  */
540
- class BroadcastChannel {
639
+ class BroadcastChannel extends EventTarget {
541
640
  readonly name: string;
542
641
  /**
543
642
  * Invoked with a single \`MessageEvent\` argument when a message is received.
544
643
  * @since v15.4.0
545
644
  */
546
- onmessage: (message: unknown) => void;
645
+ onmessage: (message: MessageEvent) => void;
547
646
  /**
548
647
  * Invoked with a received message cannot be deserialized.
549
648
  * @since v15.4.0
550
649
  */
551
- onmessageerror: (message: unknown) => void;
650
+ onmessageerror: (message: MessageEvent) => void;
552
651
  constructor(name: string);
553
652
  /**
554
653
  * Closes the `BroadcastChannel` connection.
@@ -561,6 +660,35 @@ declare module "worker_threads" {
561
660
  */
562
661
  postMessage(message: unknown): void;
563
662
  }
663
+ interface Lock {
664
+ readonly mode: LockMode;
665
+ readonly name: string;
666
+ }
667
+ interface LockGrantedCallback<T> {
668
+ (lock: Lock | null): T;
669
+ }
670
+ interface LockInfo {
671
+ clientId: string;
672
+ mode: LockMode;
673
+ name: string;
674
+ }
675
+ interface LockManager {
676
+ query(): Promise<LockManagerSnapshot>;
677
+ request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
678
+ request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
679
+ }
680
+ interface LockManagerSnapshot {
681
+ held: LockInfo[];
682
+ pending: LockInfo[];
683
+ }
684
+ type LockMode = "exclusive" | "shared";
685
+ interface LockOptions {
686
+ ifAvailable?: boolean;
687
+ mode?: LockMode;
688
+ signal?: AbortSignal;
689
+ steal?: boolean;
690
+ }
691
+ var locks: LockManager;
564
692
  /**
565
693
  * Mark an object as not transferable. If `object` occurs in the transfer list of
566
694
  * a `port.postMessage()` call, it is ignored.
@@ -701,7 +829,25 @@ declare module "worker_threads" {
701
829
  * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
702
830
  * for the `key` will be deleted.
703
831
  */
704
- function setEnvironmentData(key: Serializable, value: Serializable): void;
832
+ function setEnvironmentData(key: Serializable, value?: Serializable): void;
833
+ /**
834
+ * Sends a value to another worker, identified by its thread ID.
835
+ * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
836
+ * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
837
+ * @param value The value to send.
838
+ * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
839
+ * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
840
+ * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
841
+ * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
842
+ * @since v22.5.0
843
+ */
844
+ function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
845
+ function postMessageToThread(
846
+ threadId: number,
847
+ value: any,
848
+ transferList: readonly Transferable[],
849
+ timeout?: number,
850
+ ): Promise<void>;
705
851
 
706
852
  import {
707
853
  BroadcastChannel as _BroadcastChannel,
@@ -709,6 +855,10 @@ declare module "worker_threads" {
709
855
  MessagePort as _MessagePort,
710
856
  } from "worker_threads";
711
857
  global {
858
+ function structuredClone<T>(
859
+ value: T,
860
+ options?: { transfer?: Transferable[] },
861
+ ): T;
712
862
  /**
713
863
  * `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
714
864
  * https://nodejs.org/api/globals.html#broadcastchannel