@types/node 22.15.31 → 24.0.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 (71) hide show
  1. node v22.15/README.md → node/README.md +1 -1
  2. node v22.15/assert.d.ts → node/assert.d.ts +5 -5
  3. node v22.15/async_hooks.d.ts → node/async_hooks.d.ts +26 -6
  4. node v22.15/buffer.d.ts → node/buffer.d.ts +1 -2
  5. node v22.15/child_process.d.ts → node/child_process.d.ts +2 -2
  6. node v22.15/cluster.d.ts → node/cluster.d.ts +15 -15
  7. node v22.15/compatibility/iterators.d.ts → node/compatibility/iterators.d.ts +1 -0
  8. node v22.15/console.d.ts → node/console.d.ts +17 -17
  9. node v22.15/crypto.d.ts → node/crypto.d.ts +35 -28
  10. node v22.15/dgram.d.ts → node/dgram.d.ts +1 -1
  11. node v22.15/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +1 -1
  12. node v22.15/dns.d.ts → node/dns.d.ts +16 -16
  13. node v22.15/domain.d.ts → node/domain.d.ts +1 -1
  14. node v22.15/events.d.ts → node/events.d.ts +1 -2
  15. node v22.15/fs/promises.d.ts → node/fs/promises.d.ts +16 -9
  16. node v22.15/fs.d.ts → node/fs.d.ts +28 -19
  17. node v22.15/globals.d.ts → node/globals.d.ts +7 -4
  18. node v22.15/globals.typedarray.d.ts → node/globals.typedarray.d.ts +1 -0
  19. node v22.15/http.d.ts → node/http.d.ts +2 -2
  20. node v22.15/http2.d.ts → node/http2.d.ts +6 -3
  21. node v22.15/https.d.ts → node/https.d.ts +1 -1
  22. node v22.15/index.d.ts → node/index.d.ts +7 -5
  23. node v22.15/inspector.d.ts → node/inspector.d.ts +3 -7
  24. node v22.15/module.d.ts → node/module.d.ts +64 -29
  25. node v22.15/net.d.ts → node/net.d.ts +2 -5
  26. node v22.15/os.d.ts → node/os.d.ts +8 -7
  27. node v22.15/package.json → node/package.json +13 -3
  28. node v22.15/path.d.ts → node/path.d.ts +1 -1
  29. node v22.15/perf_hooks.d.ts → node/perf_hooks.d.ts +8 -8
  30. node v22.15/process.d.ts → node/process.d.ts +21 -11
  31. node v22.15/punycode.d.ts → node/punycode.d.ts +1 -1
  32. node v22.15/querystring.d.ts → node/querystring.d.ts +1 -1
  33. node v22.15/readline/promises.d.ts → node/readline/promises.d.ts +0 -1
  34. node v22.15/readline.d.ts → node/readline.d.ts +13 -13
  35. node v22.15/repl.d.ts → node/repl.d.ts +14 -16
  36. node v22.15/sea.d.ts → node/sea.d.ts +1 -1
  37. node v22.15/sqlite.d.ts → node/sqlite.d.ts +182 -2
  38. node v22.15/stream.d.ts → node/stream.d.ts +8 -19
  39. node v22.15/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  40. node v22.15/test.d.ts → node/test.d.ts +53 -13
  41. node v22.15/timers/promises.d.ts → node/timers/promises.d.ts +1 -1
  42. node v22.15/timers.d.ts → node/timers.d.ts +1 -1
  43. node v22.15/tls.d.ts → node/tls.d.ts +2 -48
  44. node v22.15/trace_events.d.ts → node/trace_events.d.ts +6 -6
  45. node v22.15/compatibility/disposable.d.ts → node/ts5.1/compatibility/disposable.d.ts +0 -2
  46. node/ts5.1/index.d.ts +98 -0
  47. node/ts5.6/compatibility/float16array.d.ts +71 -0
  48. node v22.15/ts5.6/globals.typedarray.d.ts → node/ts5.6/globals.typedarray.d.ts +1 -0
  49. node v22.15/ts5.6/index.d.ts → node/ts5.6/index.d.ts +9 -5
  50. node/ts5.7/compatibility/float16array.d.ts +72 -0
  51. node/ts5.7/index.d.ts +96 -0
  52. node v22.15/tty.d.ts → node/tty.d.ts +1 -1
  53. node v22.15/url.d.ts → node/url.d.ts +52 -19
  54. node v22.15/util.d.ts → node/util.d.ts +16 -295
  55. node v22.15/v8.d.ts → node/v8.d.ts +29 -32
  56. node v22.15/vm.d.ts → node/vm.d.ts +17 -10
  57. node v22.15/wasi.d.ts → node/wasi.d.ts +1 -1
  58. node v22.15/worker_threads.d.ts → node/worker_threads.d.ts +35 -18
  59. node v22.15/zlib.d.ts → node/zlib.d.ts +5 -7
  60. node v22.15/compatibility/index.d.ts +0 -9
  61. node v22.15/compatibility/indexable.d.ts +0 -20
  62. {node v22.15 → node}/LICENSE +0 -0
  63. {node v22.15 → node}/assert/strict.d.ts +0 -0
  64. {node v22.15 → node}/buffer.buffer.d.ts +0 -0
  65. {node v22.15 → node}/constants.d.ts +0 -0
  66. {node v22.15 → node}/dns/promises.d.ts +0 -0
  67. {node v22.15 → node}/dom-events.d.ts +0 -0
  68. {node v22.15 → node}/stream/consumers.d.ts +0 -0
  69. {node v22.15 → node}/stream/promises.d.ts +0 -0
  70. {node v22.15 → node}/stream/web.d.ts +0 -0
  71. {node v22.15 → node}/ts5.6/buffer.buffer.d.ts +0 -0
@@ -34,7 +34,7 @@
34
34
  *
35
35
  * console.log(x); // 1; y is not defined.
36
36
  * ```
37
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/vm.js)
37
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
38
38
  */
39
39
  declare module "vm" {
40
40
  import { ImportAttributes } from "node:module";
@@ -60,6 +60,7 @@ declare module "vm" {
60
60
  specifier: string,
61
61
  referrer: T,
62
62
  importAttributes: ImportAttributes,
63
+ phase: "source" | "evaluation",
63
64
  ) => Module | Promise<Module>;
64
65
  interface ScriptOptions extends BaseOptions {
65
66
  /**
@@ -71,7 +72,8 @@ declare module "vm" {
71
72
  /**
72
73
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
73
74
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
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).
75
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
76
+ * @experimental
75
77
  */
76
78
  importModuleDynamically?:
77
79
  | DynamicModuleLoader<Script>
@@ -122,7 +124,8 @@ declare module "vm" {
122
124
  /**
123
125
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
124
126
  * 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).
127
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
128
+ * @experimental
126
129
  */
127
130
  importModuleDynamically?:
128
131
  | DynamicModuleLoader<Script>
@@ -137,7 +140,8 @@ declare module "vm" {
137
140
  /**
138
141
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
139
142
  * 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).
143
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
144
+ * @experimental
141
145
  */
142
146
  importModuleDynamically?:
143
147
  | DynamicModuleLoader<Script>
@@ -165,7 +169,8 @@ declare module "vm" {
165
169
  /**
166
170
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
167
171
  * 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).
172
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
173
+ * @experimental
169
174
  */
170
175
  importModuleDynamically?:
171
176
  | DynamicModuleLoader<ReturnType<typeof compileFunction>>
@@ -208,7 +213,8 @@ declare module "vm" {
208
213
  /**
209
214
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
210
215
  * 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).
216
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
217
+ * @experimental
212
218
  */
213
219
  importModuleDynamically?:
214
220
  | DynamicModuleLoader<Context>
@@ -410,9 +416,9 @@ declare module "vm" {
410
416
  }
411
417
  /**
412
418
  * If the given `contextObject` is an object, the `vm.createContext()` method will
413
- * [prepare that object](https://nodejs.org/docs/latest-v22.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
419
+ * [prepare that object](https://nodejs.org/docs/latest-v24.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
414
420
  * and return a reference to it so that it can be used in calls to {@link runInContext} or
415
- * [`script.runInContext()`](https://nodejs.org/docs/latest-v22.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
421
+ * [`script.runInContext()`](https://nodejs.org/docs/latest-v24.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
416
422
  * Inside such scripts, the global object will be wrapped by the `contextObject`, retaining all of its
417
423
  * existing properties but also having the built-in objects and functions any standard
418
424
  * [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global
@@ -907,7 +913,8 @@ declare module "vm" {
907
913
  /**
908
914
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
909
915
  * 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).
916
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
917
+ * @experimental
911
918
  */
912
919
  importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
913
920
  }
@@ -1005,7 +1012,7 @@ declare module "vm" {
1005
1012
  * and `vm.compileFunction()` so that Node.js uses the default ESM loader from the main
1006
1013
  * context to load the requested module.
1007
1014
  *
1008
- * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
1015
+ * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
1009
1016
  * @since v21.7.0, v20.12.0
1010
1017
  */
1011
1018
  const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
@@ -67,7 +67,7 @@
67
67
  * wat2wasm demo.wat
68
68
  * ```
69
69
  * @experimental
70
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/wasi.js)
70
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/wasi.js)
71
71
  */
72
72
  declare module "wasi" {
73
73
  interface WASIOptions {
@@ -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,7 +52,7 @@
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
58
  import { Context } from "node:vm";
@@ -59,6 +62,7 @@ declare module "worker_threads" {
59
62
  import { Readable, Writable } from "node:stream";
60
63
  import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
61
64
  import { URL } from "node:url";
65
+ import { HeapInfo } from "node:v8";
62
66
  const isInternalThread: boolean;
63
67
  const isMainThread: boolean;
64
68
  const parentPort: null | MessagePort;
@@ -97,6 +101,7 @@ declare module "worker_threads" {
97
101
  | WritableStream
98
102
  | TransformStream;
99
103
  /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
104
+ // TODO: remove in a future major @types/node version.
100
105
  type TransferListItem = Transferable;
101
106
  /**
102
107
  * Instances of the `worker.MessagePort` class represent one end of an
@@ -183,6 +188,11 @@ declare module "worker_threads" {
183
188
  * @since v10.5.0
184
189
  */
185
190
  postMessage(value: any, transferList?: readonly Transferable[]): void;
191
+ /**
192
+ * If true, the `MessagePort` object will keep the Node.js event loop active.
193
+ * @since v18.1.0, v16.17.0
194
+ */
195
+ hasRef(): boolean;
186
196
  /**
187
197
  * 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
188
198
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -465,6 +475,13 @@ declare module "worker_threads" {
465
475
  * @return A promise for a Readable Stream containing a V8 heap snapshot
466
476
  */
467
477
  getHeapSnapshot(): Promise<Readable>;
478
+ /**
479
+ * This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
480
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
481
+ * This methods allows the statistics to be observed from outside the actual thread.
482
+ * @since v24.0.0
483
+ */
484
+ getHeapStatistics(): Promise<HeapInfo>;
468
485
  addListener(event: "error", listener: (err: Error) => void): this;
469
486
  addListener(event: "exit", listener: (exitCode: number) => void): this;
470
487
  addListener(event: "message", listener: (value: any) => void): this;
@@ -9,7 +9,7 @@
9
9
  * ```
10
10
  *
11
11
  * Compression and decompression are built around the Node.js
12
- * [Streams API](https://nodejs.org/docs/latest-v22.x/api/stream.html).
12
+ * [Streams API](https://nodejs.org/docs/latest-v24.x/api/stream.html).
13
13
  *
14
14
  * Compressing or decompressing a stream (such as a file) can be accomplished by
15
15
  * piping the source stream through a `zlib` `Transform` stream into a destination
@@ -89,7 +89,7 @@
89
89
  * });
90
90
  * ```
91
91
  * @since v0.5.8
92
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/zlib.js)
92
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js)
93
93
  */
94
94
  declare module "zlib" {
95
95
  import * as stream from "node:stream";
@@ -143,7 +143,7 @@ declare module "zlib" {
143
143
  }
144
144
  | undefined;
145
145
  /**
146
- * Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v22.x/api/zlib.html#convenience-methods).
146
+ * Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
147
147
  * @default buffer.kMaxLength
148
148
  */
149
149
  maxOutputLength?: number | undefined;
@@ -163,19 +163,17 @@ declare module "zlib" {
163
163
  chunkSize?: number | undefined;
164
164
  /**
165
165
  * Key-value object containing indexed
166
- * [Zstd parameters](https://nodejs.org/docs/latest-v22.x/api/zlib.html#zstd-constants).
166
+ * [Zstd parameters](https://nodejs.org/docs/latest-v24.x/api/zlib.html#zstd-constants).
167
167
  */
168
168
  params?: { [key: number]: number | boolean } | undefined;
169
169
  /**
170
170
  * Limits output size when using
171
- * [convenience methods](https://nodejs.org/docs/latest-v22.x/api/zlib.html#convenience-methods).
171
+ * [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
172
172
  * @default buffer.kMaxLength
173
173
  */
174
174
  maxOutputLength?: number | undefined;
175
175
  }
176
176
  interface Zlib {
177
- /** @deprecated Use bytesWritten instead. */
178
- readonly bytesRead: number;
179
177
  readonly bytesWritten: number;
180
178
  shell?: boolean | string | undefined;
181
179
  close(callback?: () => void): void;
@@ -1,9 +0,0 @@
1
- // Declaration files in this directory contain types relating to TypeScript library features
2
- // that are not included in all TypeScript versions supported by DefinitelyTyped, but
3
- // which can be made backwards-compatible without needing `typesVersions`.
4
- // If adding declarations to this directory, please specify which versions of TypeScript require them,
5
- // so that they can be removed when no longer needed.
6
-
7
- /// <reference path="disposable.d.ts" />
8
- /// <reference path="indexable.d.ts" />
9
- /// <reference path="iterators.d.ts" />
@@ -1,20 +0,0 @@
1
- // Polyfill for ES2022's .at() method on string/array prototypes, added to TypeScript in 4.6.
2
-
3
- interface RelativeIndexable<T> {
4
- at(index: number): T | undefined;
5
- }
6
-
7
- interface String extends RelativeIndexable<string> {}
8
- interface Array<T> extends RelativeIndexable<T> {}
9
- interface ReadonlyArray<T> extends RelativeIndexable<T> {}
10
- interface Int8Array extends RelativeIndexable<number> {}
11
- interface Uint8Array extends RelativeIndexable<number> {}
12
- interface Uint8ClampedArray extends RelativeIndexable<number> {}
13
- interface Int16Array extends RelativeIndexable<number> {}
14
- interface Uint16Array extends RelativeIndexable<number> {}
15
- interface Int32Array extends RelativeIndexable<number> {}
16
- interface Uint32Array extends RelativeIndexable<number> {}
17
- interface Float32Array extends RelativeIndexable<number> {}
18
- interface Float64Array extends RelativeIndexable<number> {}
19
- interface BigInt64Array extends RelativeIndexable<bigint> {}
20
- interface BigUint64Array extends RelativeIndexable<bigint> {}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes