@types/node 22.15.26 → 22.15.28

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.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 29 May 2025 23:02:21 GMT
11
+ * Last updated: Fri, 30 May 2025 15:02:22 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/globals.d.ts CHANGED
@@ -266,11 +266,6 @@ declare global {
266
266
 
267
267
  // Global DOM types
268
268
 
269
- function structuredClone<T>(
270
- value: T,
271
- transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
272
- ): T;
273
-
274
269
  interface DOMException extends _DOMException {}
275
270
  var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
276
271
  : NodeDOMExceptionConstructor;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.15.26",
3
+ "version": "22.15.28",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~6.21.0"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "396d40f2ce0ddd8afa08e7ce4e4629ae9b67d6c511d0f44b0d0e511763140857",
223
+ "typesPublisherContentHash": "db44d4d8e306b0a65418c772ae0993c94eeed587664db5b3b7b195e7f4b2e0aa",
224
224
  "typeScriptVersion": "5.1"
225
225
  }
node/vm.d.ts CHANGED
@@ -56,6 +56,11 @@ declare module "vm" {
56
56
  */
57
57
  columnOffset?: number | undefined;
58
58
  }
59
+ type DynamicModuleLoader<T> = (
60
+ specifier: string,
61
+ referrer: T,
62
+ importAttributes: ImportAttributes,
63
+ ) => Module | Promise<Module>;
59
64
  interface ScriptOptions extends BaseOptions {
60
65
  /**
61
66
  * Provides an optional data with V8's code cache data for the supplied source.
@@ -69,7 +74,7 @@ declare module "vm" {
69
74
  * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
70
75
  */
71
76
  importModuleDynamically?:
72
- | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module | Promise<Module>)
77
+ | DynamicModuleLoader<Script>
73
78
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
74
79
  | undefined;
75
80
  }
@@ -114,14 +119,30 @@ declare module "vm" {
114
119
  * Provides an optional data with V8's code cache data for the supplied source.
115
120
  */
116
121
  cachedData?: ScriptOptions["cachedData"] | undefined;
117
- importModuleDynamically?: ScriptOptions["importModuleDynamically"];
122
+ /**
123
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
124
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
125
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
126
+ */
127
+ importModuleDynamically?:
128
+ | DynamicModuleLoader<Script>
129
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
130
+ | undefined;
118
131
  }
119
132
  interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
120
133
  /**
121
134
  * Provides an optional data with V8's code cache data for the supplied source.
122
135
  */
123
136
  cachedData?: ScriptOptions["cachedData"] | undefined;
124
- importModuleDynamically?: ScriptOptions["importModuleDynamically"];
137
+ /**
138
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
139
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
140
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
141
+ */
142
+ importModuleDynamically?:
143
+ | DynamicModuleLoader<Script>
144
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
145
+ | undefined;
125
146
  }
126
147
  interface CompileFunctionOptions extends BaseOptions {
127
148
  /**
@@ -141,6 +162,15 @@ declare module "vm" {
141
162
  * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
142
163
  */
143
164
  contextExtensions?: Object[] | undefined;
165
+ /**
166
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
167
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
168
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
169
+ */
170
+ importModuleDynamically?:
171
+ | DynamicModuleLoader<ReturnType<typeof compileFunction>>
172
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
173
+ | undefined;
144
174
  }
145
175
  interface CreateContextOptions {
146
176
  /**
@@ -175,6 +205,15 @@ declare module "vm" {
175
205
  * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
176
206
  */
177
207
  microtaskMode?: "afterEvaluate" | undefined;
208
+ /**
209
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
210
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
211
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
212
+ */
213
+ importModuleDynamically?:
214
+ | DynamicModuleLoader<Context>
215
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
216
+ | undefined;
178
217
  }
179
218
  type MeasureMemoryMode = "summary" | "detailed";
180
219
  interface MeasureMemoryOptions {
@@ -865,13 +904,12 @@ declare module "vm" {
865
904
  * Called during evaluation of this module to initialize the `import.meta`.
866
905
  */
867
906
  initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
868
- importModuleDynamically?:
869
- | ((
870
- specifier: string,
871
- referrer: SourceTextModule,
872
- importAttributes: ImportAttributes,
873
- ) => Module | Promise<Module>)
874
- | undefined;
907
+ /**
908
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
909
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
910
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
911
+ */
912
+ importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
875
913
  }
876
914
  /**
877
915
  * This feature is only available with the `--experimental-vm-modules` command
node/worker_threads.d.ts CHANGED
@@ -52,14 +52,13 @@
52
52
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/worker_threads.js)
53
53
  */
54
54
  declare module "worker_threads" {
55
- import { Blob } from "node:buffer";
56
55
  import { Context } from "node:vm";
57
56
  import { EventEmitter } from "node:events";
58
57
  import { EventLoopUtilityFunction } from "node:perf_hooks";
59
58
  import { FileHandle } from "node:fs/promises";
60
59
  import { Readable, Writable } from "node:stream";
60
+ import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
61
61
  import { URL } from "node:url";
62
- import { X509Certificate } from "node:crypto";
63
62
  const isInternalThread: boolean;
64
63
  const isMainThread: boolean;
65
64
  const parentPort: null | MessagePort;
@@ -89,7 +88,17 @@ declare module "worker_threads" {
89
88
  interface WorkerPerformance {
90
89
  eventLoopUtilization: EventLoopUtilityFunction;
91
90
  }
92
- type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
91
+ type Transferable =
92
+ | ArrayBuffer
93
+ | MessagePort
94
+ | AbortSignal
95
+ | FileHandle
96
+ | ReadableStream
97
+ | WritableStream
98
+ | TransformStream;
99
+ /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
100
+ // TODO: remove in a future major @types/node version.
101
+ type TransferListItem = Transferable;
93
102
  /**
94
103
  * Instances of the `worker.MessagePort` class represent one end of an
95
104
  * asynchronous, two-way communications channel. It can be used to transfer
@@ -174,7 +183,7 @@ declare module "worker_threads" {
174
183
  * behind this API, see the `serialization API of the node:v8 module`.
175
184
  * @since v10.5.0
176
185
  */
177
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
186
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
178
187
  /**
179
188
  * 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
189
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -261,7 +270,7 @@ declare module "worker_threads" {
261
270
  /**
262
271
  * Additional data to send in the first worker message.
263
272
  */
264
- transferList?: TransferListItem[] | undefined;
273
+ transferList?: Transferable[] | undefined;
265
274
  /**
266
275
  * @default true
267
276
  */
@@ -409,7 +418,7 @@ declare module "worker_threads" {
409
418
  * See `port.postMessage()` for more details.
410
419
  * @since v10.5.0
411
420
  */
412
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
421
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
413
422
  /**
414
423
  * Sends a value to another worker, identified by its thread ID.
415
424
  * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
@@ -425,7 +434,7 @@ declare module "worker_threads" {
425
434
  postMessageToThread(
426
435
  threadId: number,
427
436
  value: any,
428
- transferList: readonly TransferListItem[],
437
+ transferList: readonly Transferable[],
429
438
  timeout?: number,
430
439
  ): Promise<void>;
431
440
  /**
@@ -709,6 +718,10 @@ declare module "worker_threads" {
709
718
  MessagePort as _MessagePort,
710
719
  } from "worker_threads";
711
720
  global {
721
+ function structuredClone<T>(
722
+ value: T,
723
+ options?: { transfer?: Transferable[] },
724
+ ): T;
712
725
  /**
713
726
  * `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
714
727
  * https://nodejs.org/api/globals.html#broadcastchannel