@types/node 22.16.0 → 24.0.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 (72) hide show
  1. node v22.16/README.md → node/README.md +2 -2
  2. node v22.16/assert.d.ts → node/assert.d.ts +5 -5
  3. node v22.16/async_hooks.d.ts → node/async_hooks.d.ts +25 -5
  4. node v22.16/buffer.d.ts → node/buffer.d.ts +1 -4
  5. node v22.16/child_process.d.ts → node/child_process.d.ts +2 -2
  6. node v22.16/cluster.d.ts → node/cluster.d.ts +15 -15
  7. node v22.16/compatibility/iterators.d.ts → node/compatibility/iterators.d.ts +1 -0
  8. node v22.16/console.d.ts → node/console.d.ts +17 -17
  9. node v22.16/crypto.d.ts → node/crypto.d.ts +35 -28
  10. node v22.16/dgram.d.ts → node/dgram.d.ts +1 -1
  11. node v22.16/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +1 -1
  12. node v22.16/dns/promises.d.ts → node/dns/promises.d.ts +1 -27
  13. node v22.16/dns.d.ts → node/dns.d.ts +18 -72
  14. node v22.16/domain.d.ts → node/domain.d.ts +1 -1
  15. node v22.16/events.d.ts → node/events.d.ts +1 -1
  16. node v22.16/fs/promises.d.ts → node/fs/promises.d.ts +18 -12
  17. node v22.16/fs.d.ts → node/fs.d.ts +29 -20
  18. node v22.16/globals.d.ts → node/globals.d.ts +7 -4
  19. node v22.16/globals.typedarray.d.ts → node/globals.typedarray.d.ts +1 -0
  20. node v22.16/http.d.ts → node/http.d.ts +3 -80
  21. node v22.16/http2.d.ts → node/http2.d.ts +6 -3
  22. node v22.16/https.d.ts → node/https.d.ts +1 -1
  23. node v22.16/index.d.ts → node/index.d.ts +7 -5
  24. node v22.16/inspector.d.ts → node/inspector.d.ts +3 -7
  25. node v22.16/module.d.ts → node/module.d.ts +18 -63
  26. node v22.16/net.d.ts → node/net.d.ts +2 -5
  27. node v22.16/os.d.ts → node/os.d.ts +8 -7
  28. node v22.16/package.json → node/package.json +13 -3
  29. node v22.16/path.d.ts → node/path.d.ts +1 -1
  30. node v22.16/perf_hooks.d.ts → node/perf_hooks.d.ts +8 -8
  31. node v22.16/process.d.ts → node/process.d.ts +21 -9
  32. node v22.16/punycode.d.ts → node/punycode.d.ts +1 -1
  33. node v22.16/querystring.d.ts → node/querystring.d.ts +1 -1
  34. node v22.16/readline/promises.d.ts → node/readline/promises.d.ts +0 -1
  35. node v22.16/readline.d.ts → node/readline.d.ts +13 -13
  36. node v22.16/repl.d.ts → node/repl.d.ts +12 -12
  37. node v22.16/sea.d.ts → node/sea.d.ts +1 -1
  38. node v22.16/sqlite.d.ts → node/sqlite.d.ts +15 -7
  39. node v22.16/stream/web.d.ts → node/stream/web.d.ts +0 -4
  40. node v22.16/stream.d.ts → node/stream.d.ts +8 -19
  41. node v22.16/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  42. node/test.d.ts +2318 -0
  43. node v22.16/timers/promises.d.ts → node/timers/promises.d.ts +1 -1
  44. node v22.16/timers.d.ts → node/timers.d.ts +1 -1
  45. node v22.16/tls.d.ts → node/tls.d.ts +2 -48
  46. node v22.16/trace_events.d.ts → node/trace_events.d.ts +6 -6
  47. node v22.16/compatibility/disposable.d.ts → node/ts5.1/compatibility/disposable.d.ts +0 -2
  48. node/ts5.1/index.d.ts +98 -0
  49. node/ts5.6/compatibility/float16array.d.ts +71 -0
  50. node v22.16/ts5.6/globals.typedarray.d.ts → node/ts5.6/globals.typedarray.d.ts +1 -0
  51. node v22.16/ts5.6/index.d.ts → node/ts5.6/index.d.ts +9 -5
  52. node/ts5.7/compatibility/float16array.d.ts +72 -0
  53. node/ts5.7/index.d.ts +96 -0
  54. node v22.16/tty.d.ts → node/tty.d.ts +1 -1
  55. node v22.16/url.d.ts → node/url.d.ts +61 -19
  56. node v22.16/util.d.ts → node/util.d.ts +7 -298
  57. node v22.16/v8.d.ts → node/v8.d.ts +29 -65
  58. node v22.16/vm.d.ts → node/vm.d.ts +17 -10
  59. node v22.16/wasi.d.ts → node/wasi.d.ts +1 -1
  60. node v22.16/worker_threads.d.ts → node/worker_threads.d.ts +8 -2
  61. node v22.16/zlib.d.ts → node/zlib.d.ts +5 -7
  62. node v22.16/compatibility/index.d.ts +0 -9
  63. node v22.16/compatibility/indexable.d.ts +0 -20
  64. node v22.16/test.d.ts +0 -2175
  65. {node v22.16 → node}/LICENSE +0 -0
  66. {node v22.16 → node}/assert/strict.d.ts +0 -0
  67. {node v22.16 → node}/buffer.buffer.d.ts +0 -0
  68. {node v22.16 → node}/constants.d.ts +0 -0
  69. {node v22.16 → node}/dom-events.d.ts +0 -0
  70. {node v22.16 → node}/stream/consumers.d.ts +0 -0
  71. {node v22.16 → node}/stream/promises.d.ts +0 -0
  72. {node v22.16 → 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 {
@@ -52,7 +52,7 @@
52
52
  *
53
53
  * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
54
54
  * specifically `argv` and `execArgv` options.
55
- * @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)
56
56
  */
57
57
  declare module "worker_threads" {
58
58
  import { Context } from "node:vm";
@@ -101,6 +101,7 @@ declare module "worker_threads" {
101
101
  | WritableStream
102
102
  | TransformStream;
103
103
  /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
104
+ // TODO: remove in a future major @types/node version.
104
105
  type TransferListItem = Transferable;
105
106
  /**
106
107
  * Instances of the `worker.MessagePort` class represent one end of an
@@ -187,6 +188,11 @@ declare module "worker_threads" {
187
188
  * @since v10.5.0
188
189
  */
189
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;
190
196
  /**
191
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
192
198
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -473,7 +479,7 @@ declare module "worker_threads" {
473
479
  * This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
474
480
  * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
475
481
  * This methods allows the statistics to be observed from outside the actual thread.
476
- * @since v22.16.0
482
+ * @since v24.0.0
477
483
  */
478
484
  getHeapStatistics(): Promise<HeapInfo>;
479
485
  addListener(event: "error", listener: (err: Error) => 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> {}