@types/node 25.1.0 → 25.2.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.
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: Wed, 28 Jan 2026 16:44:06 GMT
11
+ * Last updated: Sun, 01 Feb 2026 15:38:50 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/child_process.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * ```js
7
7
  * import { spawn } from 'node:child_process';
8
+ * import { once } from 'node:events';
8
9
  * const ls = spawn('ls', ['-lh', '/usr']);
9
10
  *
10
11
  * ls.stdout.on('data', (data) => {
@@ -15,9 +16,8 @@
15
16
  * console.error(`stderr: ${data}`);
16
17
  * });
17
18
  *
18
- * ls.on('close', (code) => {
19
- * console.log(`child process exited with code ${code}`);
20
- * });
19
+ * const [code] = await once(ls, 'close');
20
+ * console.log(`child process exited with code ${code}`);
21
21
  * ```
22
22
  *
23
23
  * By default, pipes for `stdin`, `stdout`, and `stderr` are established between
@@ -671,6 +671,7 @@ declare module "node:child_process" {
671
671
  *
672
672
  * ```js
673
673
  * import { spawn } from 'node:child_process';
674
+ * import { once } from 'node:events';
674
675
  * const ls = spawn('ls', ['-lh', '/usr']);
675
676
  *
676
677
  * ls.stdout.on('data', (data) => {
@@ -681,9 +682,8 @@ declare module "node:child_process" {
681
682
  * console.error(`stderr: ${data}`);
682
683
  * });
683
684
  *
684
- * ls.on('close', (code) => {
685
- * console.log(`child process exited with code ${code}`);
686
- * });
685
+ * const [code] = await once(ls, 'close');
686
+ * console.log(`child process exited with code ${code}`);
687
687
  * ```
688
688
  *
689
689
  * Example: A very elaborate way to run `ps ax | grep ssh`
node/crypto.d.ts CHANGED
@@ -2582,8 +2582,8 @@ declare module "node:crypto" {
2582
2582
  interface X25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2583
2583
  interface X448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
2584
2584
  /**
2585
- * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2586
- * Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
2585
+ * Generates a new asymmetric key pair of the given `type`. See the
2586
+ * supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
2587
2587
  *
2588
2588
  * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2589
2589
  * behaves as if `keyObject.export()` had been called on its result. Otherwise,
@@ -2672,8 +2672,8 @@ declare module "node:crypto" {
2672
2672
  options?: T,
2673
2673
  ): KeyPairExportResult<T>;
2674
2674
  /**
2675
- * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2676
- * Ed25519, Ed448, X25519, X448, and DH are currently supported.
2675
+ * Generates a new asymmetric key pair of the given `type`. See the
2676
+ * supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
2677
2677
  *
2678
2678
  * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2679
2679
  * behaves as if `keyObject.export()` had been called on its result. Otherwise,
node/http.d.ts CHANGED
@@ -1046,6 +1046,7 @@ declare module "node:http" {
1046
1046
  *
1047
1047
  * ```js
1048
1048
  * import http from 'node:http';
1049
+ * const agent = new http.Agent({ keepAlive: true });
1049
1050
  *
1050
1051
  * // Server has a 5 seconds keep-alive timeout by default
1051
1052
  * http
@@ -1679,20 +1680,34 @@ declare module "node:http" {
1679
1680
  /**
1680
1681
  * Produces a socket/stream to be used for HTTP requests.
1681
1682
  *
1682
- * By default, this function is the same as `net.createConnection()`. However,
1683
- * custom agents may override this method in case greater flexibility is desired.
1683
+ * By default, this function behaves identically to `net.createConnection()`,
1684
+ * synchronously returning the created socket. The optional `callback` parameter in the
1685
+ * signature is **not** used by this default implementation.
1684
1686
  *
1685
- * A socket/stream can be supplied in one of two ways: by returning the
1686
- * socket/stream from this function, or by passing the socket/stream to `callback`.
1687
+ * However, custom agents may override this method to provide greater flexibility,
1688
+ * for example, to create sockets asynchronously. When overriding `createConnection`:
1687
1689
  *
1688
- * This method is guaranteed to return an instance of the `net.Socket` class,
1689
- * a subclass of `stream.Duplex`, unless the user specifies a socket
1690
- * type other than `net.Socket`.
1690
+ * 1. **Synchronous socket creation**: The overriding method can return the
1691
+ * socket/stream directly.
1692
+ * 2. **Asynchronous socket creation**: The overriding method can accept the `callback`
1693
+ * and pass the created socket/stream to it (e.g., `callback(null, newSocket)`).
1694
+ * If an error occurs during socket creation, it should be passed as the first
1695
+ * argument to the `callback` (e.g., `callback(err)`).
1691
1696
  *
1692
- * `callback` has a signature of `(err, stream)`.
1697
+ * The agent will call the provided `createConnection` function with `options` and
1698
+ * this internal `callback`. The `callback` provided by the agent has a signature
1699
+ * of `(err, stream)`.
1693
1700
  * @since v0.11.4
1694
- * @param options Options containing connection details. Check `createConnection` for the format of the options
1695
- * @param callback Callback function that receives the created socket
1701
+ * @param options Options containing connection details. Check
1702
+ * `net.createConnection` for the format of the options. For custom agents,
1703
+ * this object is passed to the custom `createConnection` function.
1704
+ * @param callback (Optional, primarily for custom agents) A function to be
1705
+ * called by a custom `createConnection` implementation when the socket is
1706
+ * created, especially for asynchronous operations.
1707
+ * @returns The created socket. This is returned by the default
1708
+ * implementation or by a custom synchronous `createConnection` implementation.
1709
+ * If a custom `createConnection` uses the `callback` for asynchronous
1710
+ * operation, this return value might not be the primary way to obtain the socket.
1696
1711
  */
1697
1712
  createConnection(
1698
1713
  options: ClientRequestArgs,
node/https.d.ts CHANGED
@@ -24,6 +24,12 @@ declare module "node:https" {
24
24
  }
25
25
  /**
26
26
  * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
27
+ *
28
+ * Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden
29
+ * to customize how TLS connections are established.
30
+ *
31
+ * > See `agent.createConnection()` for details on overriding this method,
32
+ * > including asynchronous socket creation with a callback.
27
33
  * @since v0.4.5
28
34
  */
29
35
  class Agent extends http.Agent {
node/net.d.ts CHANGED
@@ -825,7 +825,7 @@ declare module "node:net" {
825
825
  function setDefaultAutoSelectFamily(value: boolean): void;
826
826
  /**
827
827
  * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
828
- * The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
828
+ * The initial default value is `500` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
829
829
  * @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
830
830
  * @since v19.8.0, v18.8.0
831
831
  */
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "25.1.0",
3
+ "version": "25.2.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -150,6 +150,6 @@
150
150
  "undici-types": "~7.16.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "44178b0b7abfa729c2d925a0f2868f64a6c34ff28a1c4e3ea939c65fe2ea10d4",
153
+ "typesPublisherContentHash": "070141665b6c093c16b6b39451f81eb12361c201bfdd3ed8dc437e63f3088059",
154
154
  "typeScriptVersion": "5.2"
155
155
  }
node/perf_hooks.d.ts CHANGED
@@ -43,11 +43,6 @@ declare module "node:perf_hooks" {
43
43
  | "net" // Node.js only
44
44
  | "node" // Node.js only
45
45
  | "resource"; // available on the Web
46
- interface EventLoopUtilization {
47
- idle: number;
48
- active: number;
49
- utilization: number;
50
- }
51
46
  interface ConnectionTimingInfo {
52
47
  domainLookupStartTime: number;
53
48
  domainLookupEndTime: number;
@@ -88,6 +83,9 @@ declare module "node:perf_hooks" {
88
83
  entryTypes?: EntryType[];
89
84
  type?: EntryType;
90
85
  }
86
+ // TODO: remove in next major
87
+ /** @deprecated Use `TimerifyOptions` instead. */
88
+ interface PerformanceTimerifyOptions extends TimerifyOptions {}
91
89
  interface PerformanceEventMap {
92
90
  "resourcetimingbufferfull": Event;
93
91
  }
@@ -137,50 +135,9 @@ declare module "node:perf_hooks" {
137
135
  options?: EventListenerOptions | boolean,
138
136
  ): void;
139
137
  /**
140
- * The `eventLoopUtilization()` method returns an object that contains the
141
- * cumulative duration of time the event loop has been both idle and active as a
142
- * high resolution milliseconds timer. The `utilization` value is the calculated
143
- * Event Loop Utilization (ELU).
144
- *
145
- * If bootstrapping has not yet finished on the main thread the properties have
146
- * the value of `0`. The ELU is immediately available on [Worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#worker-threads) since
147
- * bootstrap happens within the event loop.
148
- *
149
- * Both `utilization1` and `utilization2` are optional parameters.
150
- *
151
- * If `utilization1` is passed, then the delta between the current call's `active`
152
- * and `idle` times, as well as the corresponding `utilization` value are
153
- * calculated and returned (similar to `process.hrtime()`).
154
- *
155
- * If `utilization1` and `utilization2` are both passed, then the delta is
156
- * calculated between the two arguments. This is a convenience option because,
157
- * unlike `process.hrtime()`, calculating the ELU is more complex than a
158
- * single subtraction.
159
- *
160
- * ELU is similar to CPU utilization, except that it only measures event loop
161
- * statistics and not CPU usage. It represents the percentage of time the event
162
- * loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
163
- * No other CPU idle time is taken into consideration. The following is an example
164
- * of how a mostly idle process will have a high ELU.
138
+ * This is an alias of `perf_hooks.eventLoopUtilization()`.
165
139
  *
166
- * ```js
167
- * import { eventLoopUtilization } from 'node:perf_hooks';
168
- * import { spawnSync } from 'node:child_process';
169
- *
170
- * setImmediate(() => {
171
- * const elu = eventLoopUtilization();
172
- * spawnSync('sleep', ['5']);
173
- * console.log(eventLoopUtilization(elu).utilization);
174
- * });
175
- * ```
176
- *
177
- * Although the CPU is mostly idle while running this script, the value of
178
- * `utilization` is `1`. This is because the call to
179
- * `child_process.spawnSync()` blocks the event loop from proceeding.
180
- *
181
- * Passing in a user-defined object instead of the result of a previous call to
182
- * `eventLoopUtilization()` will lead to undefined behavior. The return values
183
- * are not guaranteed to reflect any correct state of the event loop.
140
+ * _This property is an extension by Node.js. It is not available in Web browsers._
184
141
  * @since v14.10.0, v12.19.0
185
142
  * @param utilization1 The result of a previous call to
186
143
  * `eventLoopUtilization()`.
@@ -192,40 +149,12 @@ declare module "node:perf_hooks" {
192
149
  utilization2?: EventLoopUtilization,
193
150
  ): EventLoopUtilization;
194
151
  /**
195
- * _This property is an extension by Node.js. It is not available in Web browsers._
152
+ * This is an alias of `perf_hooks.timerify()`.
196
153
  *
197
- * Wraps a function within a new function that measures the running time of the
198
- * wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
199
- * event type in order for the timing details to be accessed.
200
- *
201
- * ```js
202
- * import { performance, PerformanceObserver } from 'node:perf_hooks';
203
- *
204
- * function someFunction() {
205
- * console.log('hello world');
206
- * }
207
- *
208
- * const wrapped = performance.timerify(someFunction);
209
- *
210
- * const obs = new PerformanceObserver((list) => {
211
- * console.log(list.getEntries()[0].duration);
212
- *
213
- * performance.clearMarks();
214
- * performance.clearMeasures();
215
- * obs.disconnect();
216
- * });
217
- * obs.observe({ entryTypes: ['function'] });
218
- *
219
- * // A performance timeline entry will be created
220
- * wrapped();
221
- * ```
222
- *
223
- * If the wrapped function returns a promise, a finally handler will be attached
224
- * to the promise and the duration will be reported once the finally handler is
225
- * invoked.
154
+ * _This property is an extension by Node.js. It is not available in Web browsers._
226
155
  * @since v8.5.0
227
156
  */
228
- timerify<T extends (...args: any[]) => any>(fn: T, options?: PerformanceTimerifyOptions): T;
157
+ timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
229
158
  }
230
159
  var Performance: {
231
160
  prototype: Performance;
@@ -305,14 +234,6 @@ declare module "node:perf_hooks" {
305
234
  };
306
235
  var performance: Performance;
307
236
  // #endregion
308
- interface PerformanceTimerifyOptions {
309
- /**
310
- * A histogram object created using
311
- * `perf_hooks.createHistogram()` that will record runtime durations in
312
- * nanoseconds.
313
- */
314
- histogram?: RecordableHistogram | undefined;
315
- }
316
237
  /**
317
238
  * _This class is an extension by Node.js. It is not available in Web browsers._
318
239
  *
@@ -557,6 +478,66 @@ declare module "node:perf_hooks" {
557
478
  */
558
479
  add(other: RecordableHistogram): void;
559
480
  }
481
+ interface EventLoopUtilization {
482
+ idle: number;
483
+ active: number;
484
+ utilization: number;
485
+ }
486
+ /**
487
+ * The `eventLoopUtilization()` function returns an object that contains the
488
+ * cumulative duration of time the event loop has been both idle and active as a
489
+ * high resolution milliseconds timer. The `utilization` value is the calculated
490
+ * Event Loop Utilization (ELU).
491
+ *
492
+ * If bootstrapping has not yet finished on the main thread the properties have
493
+ * the value of `0`. The ELU is immediately available on [Worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#worker-threads) since
494
+ * bootstrap happens within the event loop.
495
+ *
496
+ * Both `utilization1` and `utilization2` are optional parameters.
497
+ *
498
+ * If `utilization1` is passed, then the delta between the current call's `active`
499
+ * and `idle` times, as well as the corresponding `utilization` value are
500
+ * calculated and returned (similar to `process.hrtime()`).
501
+ *
502
+ * If `utilization1` and `utilization2` are both passed, then the delta is
503
+ * calculated between the two arguments. This is a convenience option because,
504
+ * unlike `process.hrtime()`, calculating the ELU is more complex than a
505
+ * single subtraction.
506
+ *
507
+ * ELU is similar to CPU utilization, except that it only measures event loop
508
+ * statistics and not CPU usage. It represents the percentage of time the event
509
+ * loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
510
+ * No other CPU idle time is taken into consideration. The following is an example
511
+ * of how a mostly idle process will have a high ELU.
512
+ *
513
+ * ```js
514
+ * import { eventLoopUtilization } from 'node:perf_hooks';
515
+ * import { spawnSync } from 'node:child_process';
516
+ *
517
+ * setImmediate(() => {
518
+ * const elu = eventLoopUtilization();
519
+ * spawnSync('sleep', ['5']);
520
+ * console.log(eventLoopUtilization(elu).utilization);
521
+ * });
522
+ * ```
523
+ *
524
+ * Although the CPU is mostly idle while running this script, the value of
525
+ * `utilization` is `1`. This is because the call to
526
+ * `child_process.spawnSync()` blocks the event loop from proceeding.
527
+ *
528
+ * Passing in a user-defined object instead of the result of a previous call to
529
+ * `eventLoopUtilization()` will lead to undefined behavior. The return values
530
+ * are not guaranteed to reflect any correct state of the event loop.
531
+ * @since v25.2.0
532
+ * @param utilization1 The result of a previous call to
533
+ * `eventLoopUtilization()`.
534
+ * @param utilization2 The result of a previous call to
535
+ * `eventLoopUtilization()` prior to `utilization1`.
536
+ */
537
+ function eventLoopUtilization(
538
+ utilization1?: EventLoopUtilization,
539
+ utilization2?: EventLoopUtilization,
540
+ ): EventLoopUtilization;
560
541
  /**
561
542
  * _This property is an extension by Node.js. It is not available in Web browsers._
562
543
  *
@@ -586,6 +567,49 @@ declare module "node:perf_hooks" {
586
567
  * @since v11.10.0
587
568
  */
588
569
  function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
570
+ interface TimerifyOptions {
571
+ /**
572
+ * A histogram object created using
573
+ * `perf_hooks.createHistogram()` that will record runtime durations in
574
+ * nanoseconds.
575
+ */
576
+ histogram?: RecordableHistogram | undefined;
577
+ }
578
+ /**
579
+ * _This property is an extension by Node.js. It is not available in Web browsers._
580
+ *
581
+ * Wraps a function within a new function that measures the running time of the
582
+ * wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
583
+ * event type in order for the timing details to be accessed.
584
+ *
585
+ * ```js
586
+ * import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
587
+ *
588
+ * function someFunction() {
589
+ * console.log('hello world');
590
+ * }
591
+ *
592
+ * const wrapped = timerify(someFunction);
593
+ *
594
+ * const obs = new PerformanceObserver((list) => {
595
+ * console.log(list.getEntries()[0].duration);
596
+ *
597
+ * performance.clearMarks();
598
+ * performance.clearMeasures();
599
+ * obs.disconnect();
600
+ * });
601
+ * obs.observe({ entryTypes: ['function'] });
602
+ *
603
+ * // A performance timeline entry will be created
604
+ * wrapped();
605
+ * ```
606
+ *
607
+ * If the wrapped function returns a promise, a finally handler will be attached
608
+ * to the promise and the duration will be reported once the finally handler is
609
+ * invoked.
610
+ * @since v25.2.0
611
+ */
612
+ function timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
589
613
  interface CreateHistogramOptions {
590
614
  /**
591
615
  * The minimum recordable value. Must be an integer value greater than 0.
@@ -613,8 +637,6 @@ declare module "node:perf_hooks" {
613
637
  interface MarkOptions extends PerformanceMarkOptions {}
614
638
  /** @deprecated Use the canonical `PerformanceMeasureOptions` instead. */
615
639
  interface MeasureOptions extends PerformanceMeasureOptions {}
616
- /** @deprecated Use `PerformanceTimerifyOptions` instead. */
617
- interface TimerifyOptions extends PerformanceTimerifyOptions {}
618
640
  }
619
641
  declare module "perf_hooks" {
620
642
  export * from "node:perf_hooks";
node/process.d.ts CHANGED
@@ -253,7 +253,7 @@ declare module "node:process" {
253
253
  /**
254
254
  * A value that is `"strip"` by default,
255
255
  * `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
256
- * Node.js is run with `--no-experimental-strip-types`.
256
+ * Node.js is run with `--no-strip-types`.
257
257
  * @since v22.10.0
258
258
  */
259
259
  readonly typescript: "strip" | "transform" | false;
node/sqlite.d.ts CHANGED
@@ -484,6 +484,8 @@ declare module "node:sqlite" {
484
484
  * [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html).
485
485
  *
486
486
  * ```js
487
+ * import { DatabaseSync } from 'node:sqlite';
488
+ *
487
489
  * const sourceDb = new DatabaseSync(':memory:');
488
490
  * const targetDb = new DatabaseSync(':memory:');
489
491
  *
node/util.d.ts CHANGED
@@ -838,6 +838,15 @@ declare module "node:util" {
838
838
  */
839
839
  export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
840
840
  export { debuglog as debug };
841
+ export interface DeprecateOptions {
842
+ /**
843
+ * When false do not change the prototype of object
844
+ * while emitting the deprecation warning.
845
+ * @since v25.2.0
846
+ * @default true
847
+ */
848
+ modifyPrototype?: boolean | undefined;
849
+ }
841
850
  /**
842
851
  * The `util.deprecate()` method wraps `fn` (which may be a function or class) in
843
852
  * such a way that it is marked as deprecated.
@@ -898,7 +907,7 @@ declare module "node:util" {
898
907
  * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
899
908
  * @return The deprecated function wrapped to emit a warning.
900
909
  */
901
- export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
910
+ export function deprecate<T extends Function>(fn: T, msg: string, code?: string, options?: DeprecateOptions): T;
902
911
  export interface IsDeepStrictEqualOptions {
903
912
  /**
904
913
  * If `true`, prototype and constructor
node/v8.d.ts CHANGED
@@ -33,6 +33,7 @@ declare module "node:v8" {
33
33
  total_global_handles_size: number;
34
34
  used_global_handles_size: number;
35
35
  external_memory: number;
36
+ total_allocated_bytes: number;
36
37
  }
37
38
  interface HeapCodeStatistics {
38
39
  code_and_metadata_size: number;
@@ -93,6 +94,9 @@ declare module "node:v8" {
93
94
  * `external_memory` The value of external\_memory is the memory size of array
94
95
  * buffers and external strings.
95
96
  *
97
+ * `total_allocated_bytes` The value of total allocated bytes since the Isolate
98
+ * creation
99
+ *
96
100
  * ```js
97
101
  * {
98
102
  * total_heap_size: 7326976,