@types/node 22.18.8 → 22.18.10

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 v22.18/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/v22.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 30 Sep 2025 23:32:16 GMT
11
+ * Last updated: Sat, 11 Oct 2025 14:02:18 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -69,7 +69,7 @@ declare module "child_process" {
69
69
  import { Abortable, EventEmitter } from "node:events";
70
70
  import * as dgram from "node:dgram";
71
71
  import * as net from "node:net";
72
- import { Pipe, Readable, Stream, Writable } from "node:stream";
72
+ import { Readable, Stream, Writable } from "node:stream";
73
73
  import { URL } from "node:url";
74
74
  type Serializable = string | object | number | boolean | bigint;
75
75
  type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
@@ -139,7 +139,7 @@ declare module "child_process" {
139
139
  * no IPC channel exists, this property is `undefined`.
140
140
  * @since v7.1.0
141
141
  */
142
- readonly channel?: Pipe | null | undefined;
142
+ readonly channel?: Control | null;
143
143
  /**
144
144
  * A sparse array of pipes to the child process, corresponding with positions in
145
145
  * the `stdio` option passed to {@link spawn} that have been set
@@ -612,6 +612,10 @@ declare module "child_process" {
612
612
  Readable | Writable | null | undefined, // extra, no modification
613
613
  ];
614
614
  }
615
+ interface Control extends EventEmitter {
616
+ ref(): void;
617
+ unref(): void;
618
+ }
615
619
  interface MessageOptions {
616
620
  keepOpen?: boolean | undefined;
617
621
  }
@@ -894,11 +898,12 @@ declare module "child_process" {
894
898
  interface ExecOptionsWithBufferEncoding extends ExecOptions {
895
899
  encoding: "buffer" | null; // specify `null`.
896
900
  }
901
+ // TODO: Just Plain Wrong™ (see also nodejs/node#57392)
897
902
  interface ExecException extends Error {
898
- cmd?: string | undefined;
899
- killed?: boolean | undefined;
900
- code?: number | undefined;
901
- signal?: NodeJS.Signals | undefined;
903
+ cmd?: string;
904
+ killed?: boolean;
905
+ code?: number;
906
+ signal?: NodeJS.Signals;
902
907
  stdout?: string;
903
908
  stderr?: string;
904
909
  }
@@ -1056,10 +1061,11 @@ declare module "child_process" {
1056
1061
  }
1057
1062
  /** @deprecated Use `ExecFileOptions` instead. */
1058
1063
  interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
1064
+ // TODO: execFile exceptions can take many forms... this accurately describes none of them
1059
1065
  type ExecFileException =
1060
1066
  & Omit<ExecException, "code">
1061
1067
  & Omit<NodeJS.ErrnoException, "code">
1062
- & { code?: string | number | undefined | null };
1068
+ & { code?: string | number | null };
1063
1069
  /**
1064
1070
  * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
1065
1071
  * executable `file` is spawned directly as a new process making it slightly more
@@ -1320,7 +1326,7 @@ declare module "child_process" {
1320
1326
  stderr: T;
1321
1327
  status: number | null;
1322
1328
  signal: NodeJS.Signals | null;
1323
- error?: Error | undefined;
1329
+ error?: Error;
1324
1330
  }
1325
1331
  /**
1326
1332
  * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
@@ -1409,7 +1415,7 @@ declare module "child_process" {
1409
1415
  encoding: BufferEncoding;
1410
1416
  }
1411
1417
  interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
1412
- encoding?: "buffer" | null; // specify `null`.
1418
+ encoding?: "buffer" | null | undefined; // specify `null`.
1413
1419
  }
1414
1420
  /**
1415
1421
  * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
@@ -481,7 +481,7 @@ declare module "cluster" {
481
481
  * ```
482
482
  * @since v0.7.0
483
483
  */
484
- readonly worker?: Worker | undefined;
484
+ readonly worker?: Worker;
485
485
  /**
486
486
  * A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
487
487
  *
@@ -497,7 +497,7 @@ declare module "cluster" {
497
497
  * ```
498
498
  * @since v0.7.0
499
499
  */
500
- readonly workers?: NodeJS.Dict<Worker> | undefined;
500
+ readonly workers?: NodeJS.Dict<Worker>;
501
501
  readonly SCHED_NONE: number;
502
502
  readonly SCHED_RR: number;
503
503
  /**
@@ -550,10 +550,9 @@ declare module "cluster" {
550
550
  prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
551
551
  prependListener(event: "fork", listener: (worker: Worker) => void): this;
552
552
  prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
553
- // the handle is a net.Socket or net.Server object, or undefined.
554
553
  prependListener(
555
554
  event: "message",
556
- listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
555
+ listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
557
556
  ): this;
558
557
  prependListener(event: "online", listener: (worker: Worker) => void): this;
559
558
  prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
node v22.18/crypto.d.ts CHANGED
@@ -510,50 +510,50 @@ declare module "crypto" {
510
510
  format: "jwk";
511
511
  }
512
512
  interface JsonWebKey {
513
- crv?: string | undefined;
514
- d?: string | undefined;
515
- dp?: string | undefined;
516
- dq?: string | undefined;
517
- e?: string | undefined;
518
- k?: string | undefined;
519
- kty?: string | undefined;
520
- n?: string | undefined;
521
- p?: string | undefined;
522
- q?: string | undefined;
523
- qi?: string | undefined;
524
- x?: string | undefined;
525
- y?: string | undefined;
513
+ crv?: string;
514
+ d?: string;
515
+ dp?: string;
516
+ dq?: string;
517
+ e?: string;
518
+ k?: string;
519
+ kty?: string;
520
+ n?: string;
521
+ p?: string;
522
+ q?: string;
523
+ qi?: string;
524
+ x?: string;
525
+ y?: string;
526
526
  [key: string]: unknown;
527
527
  }
528
528
  interface AsymmetricKeyDetails {
529
529
  /**
530
530
  * Key size in bits (RSA, DSA).
531
531
  */
532
- modulusLength?: number | undefined;
532
+ modulusLength?: number;
533
533
  /**
534
534
  * Public exponent (RSA).
535
535
  */
536
- publicExponent?: bigint | undefined;
536
+ publicExponent?: bigint;
537
537
  /**
538
538
  * Name of the message digest (RSA-PSS).
539
539
  */
540
- hashAlgorithm?: string | undefined;
540
+ hashAlgorithm?: string;
541
541
  /**
542
542
  * Name of the message digest used by MGF1 (RSA-PSS).
543
543
  */
544
- mgf1HashAlgorithm?: string | undefined;
544
+ mgf1HashAlgorithm?: string;
545
545
  /**
546
546
  * Minimal salt length in bytes (RSA-PSS).
547
547
  */
548
- saltLength?: number | undefined;
548
+ saltLength?: number;
549
549
  /**
550
550
  * Size of q in bits (DSA).
551
551
  */
552
- divisorLength?: number | undefined;
552
+ divisorLength?: number;
553
553
  /**
554
554
  * Name of the curve (EC).
555
555
  */
556
- namedCurve?: string | undefined;
556
+ namedCurve?: string;
557
557
  }
558
558
  /**
559
559
  * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
@@ -608,7 +608,7 @@ declare module "crypto" {
608
608
  * keys.
609
609
  * @since v11.6.0
610
610
  */
611
- asymmetricKeyType?: KeyType | undefined;
611
+ asymmetricKeyType?: KeyType;
612
612
  /**
613
613
  * This property exists only on asymmetric keys. Depending on the type of the key,
614
614
  * this object contains information about the key. None of the information obtained
@@ -622,7 +622,7 @@ declare module "crypto" {
622
622
  * Other key details might be exposed via this API using additional attributes.
623
623
  * @since v15.7.0
624
624
  */
625
- asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
625
+ asymmetricKeyDetails?: AsymmetricKeyDetails;
626
626
  /**
627
627
  * For symmetric keys, the following encoding options can be used:
628
628
  *
@@ -661,7 +661,7 @@ declare module "crypto" {
661
661
  * property is `undefined` for asymmetric keys.
662
662
  * @since v11.6.0
663
663
  */
664
- symmetricKeySize?: number | undefined;
664
+ symmetricKeySize?: number;
665
665
  /**
666
666
  * Converts a `KeyObject` instance to a `CryptoKey`.
667
667
  * @since 22.10.0
@@ -2505,15 +2505,15 @@ declare module "crypto" {
2505
2505
  /**
2506
2506
  * Name of the message digest
2507
2507
  */
2508
- hashAlgorithm?: string;
2508
+ hashAlgorithm?: string | undefined;
2509
2509
  /**
2510
2510
  * Name of the message digest used by MGF1
2511
2511
  */
2512
- mgf1HashAlgorithm?: string;
2512
+ mgf1HashAlgorithm?: string | undefined;
2513
2513
  /**
2514
2514
  * Minimal salt length in bytes
2515
2515
  */
2516
- saltLength?: string;
2516
+ saltLength?: string | undefined;
2517
2517
  }
2518
2518
  interface DSAKeyPairKeyObjectOptions {
2519
2519
  /**
@@ -2556,15 +2556,15 @@ declare module "crypto" {
2556
2556
  /**
2557
2557
  * Name of the message digest
2558
2558
  */
2559
- hashAlgorithm?: string;
2559
+ hashAlgorithm?: string | undefined;
2560
2560
  /**
2561
2561
  * Name of the message digest used by MGF1
2562
2562
  */
2563
- mgf1HashAlgorithm?: string;
2563
+ mgf1HashAlgorithm?: string | undefined;
2564
2564
  /**
2565
2565
  * Minimal salt length in bytes
2566
2566
  */
2567
- saltLength?: string;
2567
+ saltLength?: string | undefined;
2568
2568
  publicKeyEncoding: {
2569
2569
  type: "spki";
2570
2570
  format: PubF;
@@ -3554,23 +3554,23 @@ declare module "crypto" {
3554
3554
  /**
3555
3555
  * @default 'always'
3556
3556
  */
3557
- subject?: "always" | "default" | "never";
3557
+ subject?: "always" | "default" | "never" | undefined;
3558
3558
  /**
3559
3559
  * @default true
3560
3560
  */
3561
- wildcards?: boolean;
3561
+ wildcards?: boolean | undefined;
3562
3562
  /**
3563
3563
  * @default true
3564
3564
  */
3565
- partialWildcards?: boolean;
3565
+ partialWildcards?: boolean | undefined;
3566
3566
  /**
3567
3567
  * @default false
3568
3568
  */
3569
- multiLabelWildcards?: boolean;
3569
+ multiLabelWildcards?: boolean | undefined;
3570
3570
  /**
3571
3571
  * @default false
3572
3572
  */
3573
- singleLabelSubdomains?: boolean;
3573
+ singleLabelSubdomains?: boolean | undefined;
3574
3574
  }
3575
3575
  /**
3576
3576
  * Encapsulates an X509 certificate and provides read-only access to
@@ -3672,7 +3672,7 @@ declare module "crypto" {
3672
3672
  * available.
3673
3673
  * @since v15.9.0
3674
3674
  */
3675
- readonly issuerCertificate?: X509Certificate | undefined;
3675
+ readonly issuerCertificate: X509Certificate | undefined;
3676
3676
  /**
3677
3677
  * The public key `KeyObject` for this certificate.
3678
3678
  * @since v15.6.0
node v22.18/dns.d.ts CHANGED
@@ -829,7 +829,7 @@ declare module "dns" {
829
829
  * The number of tries the resolver will try contacting each name server before giving up.
830
830
  * @default 4
831
831
  */
832
- tries?: number;
832
+ tries?: number | undefined;
833
833
  }
834
834
  /**
835
835
  * An independent resolver for DNS requests.
node v22.18/events.d.ts CHANGED
@@ -484,7 +484,7 @@ declare module "events" {
484
484
  * directly rather than as a child class.
485
485
  * @default new.target.name if instantiated as a child class.
486
486
  */
487
- name?: string;
487
+ name?: string | undefined;
488
488
  }
489
489
 
490
490
  /**
node v22.18/fs.d.ts CHANGED
@@ -2385,7 +2385,7 @@ declare module "fs" {
2385
2385
  /**
2386
2386
  * @default null
2387
2387
  */
2388
- position?: number | undefined | null;
2388
+ position?: number | null | undefined;
2389
2389
  }
2390
2390
  /**
2391
2391
  * Write `buffer` to the file specified by `fd`.
@@ -4214,7 +4214,7 @@ declare module "fs" {
4214
4214
  /**
4215
4215
  * @default false
4216
4216
  */
4217
- recursive?: boolean;
4217
+ recursive?: boolean | undefined;
4218
4218
  }
4219
4219
  /**
4220
4220
  * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
@@ -4267,54 +4267,54 @@ declare module "fs" {
4267
4267
  * Dereference symlinks
4268
4268
  * @default false
4269
4269
  */
4270
- dereference?: boolean;
4270
+ dereference?: boolean | undefined;
4271
4271
  /**
4272
4272
  * When `force` is `false`, and the destination
4273
4273
  * exists, throw an error.
4274
4274
  * @default false
4275
4275
  */
4276
- errorOnExist?: boolean;
4276
+ errorOnExist?: boolean | undefined;
4277
4277
  /**
4278
4278
  * Overwrite existing file or directory. _The copy
4279
4279
  * operation will ignore errors if you set this to false and the destination
4280
4280
  * exists. Use the `errorOnExist` option to change this behavior.
4281
4281
  * @default true
4282
4282
  */
4283
- force?: boolean;
4283
+ force?: boolean | undefined;
4284
4284
  /**
4285
4285
  * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
4286
4286
  */
4287
- mode?: number;
4287
+ mode?: number | undefined;
4288
4288
  /**
4289
4289
  * When `true` timestamps from `src` will
4290
4290
  * be preserved.
4291
4291
  * @default false
4292
4292
  */
4293
- preserveTimestamps?: boolean;
4293
+ preserveTimestamps?: boolean | undefined;
4294
4294
  /**
4295
4295
  * Copy directories recursively.
4296
4296
  * @default false
4297
4297
  */
4298
- recursive?: boolean;
4298
+ recursive?: boolean | undefined;
4299
4299
  /**
4300
4300
  * When true, path resolution for symlinks will be skipped
4301
4301
  * @default false
4302
4302
  */
4303
- verbatimSymlinks?: boolean;
4303
+ verbatimSymlinks?: boolean | undefined;
4304
4304
  }
4305
4305
  export interface CopyOptions extends CopyOptionsBase {
4306
4306
  /**
4307
4307
  * Function to filter copied files/directories. Return
4308
4308
  * `true` to copy the item, `false` to ignore it.
4309
4309
  */
4310
- filter?(source: string, destination: string): boolean | Promise<boolean>;
4310
+ filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4311
4311
  }
4312
4312
  export interface CopySyncOptions extends CopyOptionsBase {
4313
4313
  /**
4314
4314
  * Function to filter copied files/directories. Return
4315
4315
  * `true` to copy the item, `false` to ignore it.
4316
4316
  */
4317
- filter?(source: string, destination: string): boolean;
4317
+ filter?: ((source: string, destination: string) => boolean) | undefined;
4318
4318
  }
4319
4319
  /**
4320
4320
  * Asynchronously copies the entire directory structure from `src` to `dest`,
@@ -143,6 +143,8 @@ declare namespace NodeJS {
143
143
  readonly [key: string]: T | undefined;
144
144
  }
145
145
 
146
+ type PartialOptions<T> = { [K in keyof T]?: T[K] | undefined };
147
+
146
148
  interface GCFunction {
147
149
  (minor?: boolean): void;
148
150
  (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
node v22.18/http.d.ts CHANGED
@@ -200,7 +200,7 @@ declare module "http" {
200
200
  "x-frame-options"?: string | undefined;
201
201
  "x-xss-protection"?: string | undefined;
202
202
  }
203
- interface ClientRequestArgs {
203
+ interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
204
204
  _defaultAgent?: Agent | undefined;
205
205
  agent?: Agent | boolean | undefined;
206
206
  auth?: string | null | undefined;
@@ -213,7 +213,6 @@ declare module "http" {
213
213
  defaultPort?: number | string | undefined;
214
214
  family?: number | undefined;
215
215
  headers?: OutgoingHttpHeaders | readonly string[] | undefined;
216
- hints?: LookupOptions["hints"];
217
216
  host?: string | null | undefined;
218
217
  hostname?: string | null | undefined;
219
218
  insecureHTTPParser?: boolean | undefined;
@@ -234,7 +233,7 @@ declare module "http" {
234
233
  socketPath?: string | undefined;
235
234
  timeout?: number | undefined;
236
235
  uniqueHeaders?: Array<string | string[]> | undefined;
237
- joinDuplicateHeaders?: boolean;
236
+ joinDuplicateHeaders?: boolean | undefined;
238
237
  }
239
238
  interface ServerOptions<
240
239
  Request extends typeof IncomingMessage = typeof IncomingMessage,
@@ -260,7 +259,7 @@ declare module "http" {
260
259
  * @default false
261
260
  * @since v18.14.0
262
261
  */
263
- joinDuplicateHeaders?: boolean;
262
+ joinDuplicateHeaders?: boolean | undefined;
264
263
  /**
265
264
  * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
266
265
  * after it has finished writing the last response, before a socket will be destroyed.
@@ -1419,7 +1418,7 @@ declare module "http" {
1419
1418
  */
1420
1419
  destroy(error?: Error): this;
1421
1420
  }
1422
- interface AgentOptions extends Partial<TcpSocketConnectOpts> {
1421
+ interface AgentOptions extends NodeJS.PartialOptions<TcpSocketConnectOpts> {
1423
1422
  /**
1424
1423
  * Keep sockets around in a pool to be used by other requests in the future. Default = false
1425
1424
  */
node v22.18/http2.d.ts CHANGED
@@ -55,14 +55,15 @@ declare module "http2" {
55
55
  length: number;
56
56
  }
57
57
  export interface ServerStreamFileResponseOptions {
58
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
59
- statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
58
+ statCheck?:
59
+ | ((stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void)
60
+ | undefined;
60
61
  waitForTrailers?: boolean | undefined;
61
62
  offset?: number | undefined;
62
63
  length?: number | undefined;
63
64
  }
64
65
  export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
65
- onError?(err: NodeJS.ErrnoException): void;
66
+ onError?: ((err: NodeJS.ErrnoException) => void) | undefined;
66
67
  }
67
68
  export interface Http2Stream extends stream.Duplex {
68
69
  /**
node v22.18/https.d.ts CHANGED
@@ -8,20 +8,17 @@ declare module "https" {
8
8
  import * as tls from "node:tls";
9
9
  import * as http from "node:http";
10
10
  import { URL } from "node:url";
11
- type ServerOptions<
11
+ interface ServerOptions<
12
12
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
13
  Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
14
- > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
- type RequestOptions =
16
- & http.RequestOptions
17
- & tls.SecureContextOptions
18
- & {
19
- checkServerIdentity?:
20
- | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
21
- | undefined;
22
- rejectUnauthorized?: boolean | undefined; // Defaults to true
23
- servername?: string | undefined; // SNI TLS Extension
24
- };
14
+ > extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
15
+ interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
16
+ checkServerIdentity?:
17
+ | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
18
+ | undefined;
19
+ rejectUnauthorized?: boolean | undefined; // Defaults to true
20
+ servername?: string | undefined; // SNI TLS Extension
21
+ }
25
22
  interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
26
23
  maxCachedSessions?: number | undefined;
27
24
  }
node v22.18/net.d.ts CHANGED
@@ -32,7 +32,7 @@ declare module "net" {
32
32
  onread?: OnReadOpts | undefined;
33
33
  readable?: boolean | undefined;
34
34
  writable?: boolean | undefined;
35
- signal?: AbortSignal;
35
+ signal?: AbortSignal | undefined;
36
36
  }
37
37
  interface OnReadOpts {
38
38
  buffer: Uint8Array | (() => Uint8Array);
@@ -324,25 +324,25 @@ declare module "net" {
324
324
  * the socket is destroyed (for example, if the client disconnected).
325
325
  * @since v0.5.10
326
326
  */
327
- readonly remoteAddress?: string | undefined;
327
+ readonly remoteAddress: string | undefined;
328
328
  /**
329
329
  * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
330
330
  * the socket is destroyed (for example, if the client disconnected).
331
331
  * @since v0.11.14
332
332
  */
333
- readonly remoteFamily?: string | undefined;
333
+ readonly remoteFamily: string | undefined;
334
334
  /**
335
335
  * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
336
336
  * the socket is destroyed (for example, if the client disconnected).
337
337
  * @since v0.5.10
338
338
  */
339
- readonly remotePort?: number | undefined;
339
+ readonly remotePort: number | undefined;
340
340
  /**
341
341
  * The socket timeout in milliseconds as set by `socket.setTimeout()`.
342
342
  * It is `undefined` if a timeout has not been set.
343
343
  * @since v10.7.0
344
344
  */
345
- readonly timeout?: number | undefined;
345
+ readonly timeout?: number;
346
346
  /**
347
347
  * Half-closes the socket. i.e., it sends a FIN packet. It is possible the
348
348
  * server will still send some data.
node v22.18/os.d.ts CHANGED
@@ -30,10 +30,10 @@ declare module "os" {
30
30
  mac: string;
31
31
  internal: boolean;
32
32
  cidr: string | null;
33
+ scopeid?: number;
33
34
  }
34
35
  interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
35
36
  family: "IPv4";
36
- scopeid?: undefined;
37
37
  }
38
38
  interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
39
39
  family: "IPv6";
@@ -231,6 +231,15 @@ declare module "os" {
231
231
  * @since v2.3.0
232
232
  */
233
233
  function homedir(): string;
234
+ interface UserInfoOptions {
235
+ encoding?: BufferEncoding | "buffer" | undefined;
236
+ }
237
+ interface UserInfoOptionsWithBufferEncoding extends UserInfoOptions {
238
+ encoding: "buffer";
239
+ }
240
+ interface UserInfoOptionsWithStringEncoding extends UserInfoOptions {
241
+ encoding?: BufferEncoding | undefined;
242
+ }
234
243
  /**
235
244
  * Returns information about the currently effective user. On POSIX platforms,
236
245
  * this is typically a subset of the password file. The returned object includes
@@ -244,8 +253,9 @@ declare module "os" {
244
253
  * Throws a [`SystemError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
245
254
  * @since v6.0.0
246
255
  */
247
- function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
248
- function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
256
+ function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo<Buffer>;
257
+ function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo<string>;
258
+ function userInfo(options: UserInfoOptions): UserInfo<string | Buffer>;
249
259
  type SignalConstants = {
250
260
  [key in NodeJS.Signals]: number;
251
261
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.18.8",
3
+ "version": "22.18.10",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -140,6 +140,6 @@
140
140
  "undici-types": "~6.21.0"
141
141
  },
142
142
  "peerDependencies": {},
143
- "typesPublisherContentHash": "044f75e3119c1f821a07c434b16c3cebf99c812c67c1db15d8b7abd8caad071d",
143
+ "typesPublisherContentHash": "e5707cd0627075030e43d45d8ff396de8a8bb1b71fd581233c7a8febe823657c",
144
144
  "typeScriptVersion": "5.2"
145
145
  }
@@ -48,13 +48,13 @@ declare module "perf_hooks" {
48
48
  * the type of garbage collection operation that occurred.
49
49
  * See perf_hooks.constants for valid values.
50
50
  */
51
- readonly kind?: number | undefined;
51
+ readonly kind: number;
52
52
  /**
53
53
  * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
54
54
  * property contains additional information about garbage collection operation.
55
55
  * See perf_hooks.constants for valid values.
56
56
  */
57
- readonly flags?: number | undefined;
57
+ readonly flags: number;
58
58
  }
59
59
  /**
60
60
  * The constructor of this class is not exposed to users directly.
@@ -92,11 +92,6 @@ declare module "perf_hooks" {
92
92
  * @since v8.5.0
93
93
  */
94
94
  readonly entryType: EntryType;
95
- /**
96
- * Additional detail specific to the `entryType`.
97
- * @since v16.0.0
98
- */
99
- readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
100
95
  toJSON(): any;
101
96
  }
102
97
  /**
@@ -104,6 +99,7 @@ declare module "perf_hooks" {
104
99
  * @since v18.2.0, v16.17.0
105
100
  */
106
101
  class PerformanceMark extends PerformanceEntry {
102
+ readonly detail: any;
107
103
  readonly duration: 0;
108
104
  readonly entryType: "mark";
109
105
  }
@@ -114,6 +110,7 @@ declare module "perf_hooks" {
114
110
  * @since v18.2.0, v16.17.0
115
111
  */
116
112
  class PerformanceMeasure extends PerformanceEntry {
113
+ readonly detail: any;
117
114
  readonly entryType: "measure";
118
115
  }
119
116
  interface UVMetrics {
@@ -130,6 +127,7 @@ declare module "perf_hooks" {
130
127
  */
131
128
  readonly eventsWaiting: number;
132
129
  }
130
+ // TODO: PerformanceNodeEntry is missing
133
131
  /**
134
132
  * _This property is an extension by Node.js. It is not available in Web browsers._
135
133
  *
@@ -225,7 +223,7 @@ declare module "perf_hooks" {
225
223
  /**
226
224
  * Additional optional detail to include with the mark.
227
225
  */
228
- detail?: unknown | undefined;
226
+ detail?: unknown;
229
227
  /**
230
228
  * Duration between start and end times.
231
229
  */
@@ -1,4 +1,5 @@
1
1
  declare module "process" {
2
+ import { Control, MessageOptions } from "node:child_process";
2
3
  import * as tty from "node:tty";
3
4
  import { Worker } from "node:worker_threads";
4
5
 
@@ -348,7 +349,7 @@ declare module "process" {
348
349
  /**
349
350
  * Can be used to change the default timezone at runtime
350
351
  */
351
- TZ?: string;
352
+ TZ?: string | undefined;
352
353
  }
353
354
  interface HRTime {
354
355
  /**
@@ -992,7 +993,7 @@ declare module "process" {
992
993
  * @since v0.1.13
993
994
  * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
994
995
  */
995
- exit(code?: number | string | null | undefined): never;
996
+ exit(code?: number | string | null): never;
996
997
  /**
997
998
  * A number which will be the process exit code, when the process either
998
999
  * exits gracefully, or is exited via {@link exit} without specifying
@@ -1003,7 +1004,7 @@ declare module "process" {
1003
1004
  * @default undefined
1004
1005
  * @since v0.11.8
1005
1006
  */
1006
- exitCode?: number | string | number | undefined;
1007
+ exitCode: number | string | null | undefined;
1007
1008
  finalization: {
1008
1009
  /**
1009
1010
  * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
@@ -1557,7 +1558,7 @@ declare module "process" {
1557
1558
  * @since v0.1.17
1558
1559
  * @deprecated Since v14.0.0 - Use `main` instead.
1559
1560
  */
1560
- mainModule?: Module | undefined;
1561
+ mainModule?: Module;
1561
1562
  memoryUsage: MemoryUsageFn;
1562
1563
  /**
1563
1564
  * Gets the amount of memory available to the process (in bytes) based on
@@ -1749,18 +1750,7 @@ declare module "process" {
1749
1750
  * If no IPC channel exists, this property is undefined.
1750
1751
  * @since v7.1.0
1751
1752
  */
1752
- channel?: {
1753
- /**
1754
- * This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
1755
- * @since v7.1.0
1756
- */
1757
- ref(): void;
1758
- /**
1759
- * This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
1760
- * @since v7.1.0
1761
- */
1762
- unref(): void;
1763
- };
1753
+ channel?: Control;
1764
1754
  /**
1765
1755
  * If Node.js is spawned with an IPC channel, the `process.send()` method can be
1766
1756
  * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
@@ -1775,9 +1765,7 @@ declare module "process" {
1775
1765
  send?(
1776
1766
  message: any,
1777
1767
  sendHandle?: any,
1778
- options?: {
1779
- keepOpen?: boolean | undefined;
1780
- },
1768
+ options?: MessageOptions,
1781
1769
  callback?: (error: Error | null) => void,
1782
1770
  ): boolean;
1783
1771
  /**
@@ -64,7 +64,7 @@ declare module "readline/promises" {
64
64
  constructor(
65
65
  stream: NodeJS.WritableStream,
66
66
  options?: {
67
- autoCommit?: boolean;
67
+ autoCommit?: boolean | undefined;
68
68
  },
69
69
  );
70
70
  /**
node v22.18/stream.d.ts CHANGED
@@ -45,22 +45,22 @@ declare module "stream" {
45
45
  emitClose?: boolean | undefined;
46
46
  highWaterMark?: number | undefined;
47
47
  objectMode?: boolean | undefined;
48
- construct?(this: T, callback: (error?: Error | null) => void): void;
49
- destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void;
48
+ construct?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
49
+ destroy?: ((this: T, error: Error | null, callback: (error?: Error | null) => void) => void) | undefined;
50
50
  autoDestroy?: boolean | undefined;
51
51
  }
52
52
  interface ReadableOptions<T extends Readable = Readable> extends StreamOptions<T> {
53
53
  encoding?: BufferEncoding | undefined;
54
- read?(this: T, size: number): void;
54
+ read?: ((this: T, size: number) => void) | undefined;
55
55
  }
56
56
  interface ArrayOptions {
57
57
  /**
58
58
  * The maximum concurrent invocations of `fn` to call on the stream at once.
59
59
  * @default 1
60
60
  */
61
- concurrency?: number;
61
+ concurrency?: number | undefined;
62
62
  /** Allows destroying the stream if the signal is aborted. */
63
- signal?: AbortSignal;
63
+ signal?: AbortSignal | undefined;
64
64
  }
65
65
  /**
66
66
  * @since v0.9.4
@@ -692,21 +692,25 @@ declare module "stream" {
692
692
  interface WritableOptions<T extends Writable = Writable> extends StreamOptions<T> {
693
693
  decodeStrings?: boolean | undefined;
694
694
  defaultEncoding?: BufferEncoding | undefined;
695
- write?(
696
- this: T,
697
- chunk: any,
698
- encoding: BufferEncoding,
699
- callback: (error?: Error | null) => void,
700
- ): void;
701
- writev?(
702
- this: T,
703
- chunks: Array<{
704
- chunk: any;
705
- encoding: BufferEncoding;
706
- }>,
707
- callback: (error?: Error | null) => void,
708
- ): void;
709
- final?(this: T, callback: (error?: Error | null) => void): void;
695
+ write?:
696
+ | ((
697
+ this: T,
698
+ chunk: any,
699
+ encoding: BufferEncoding,
700
+ callback: (error?: Error | null) => void,
701
+ ) => void)
702
+ | undefined;
703
+ writev?:
704
+ | ((
705
+ this: T,
706
+ chunks: Array<{
707
+ chunk: any;
708
+ encoding: BufferEncoding;
709
+ }>,
710
+ callback: (error?: Error | null) => void,
711
+ ) => void)
712
+ | undefined;
713
+ final?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
710
714
  }
711
715
  /**
712
716
  * @since v0.9.4
@@ -1224,8 +1228,10 @@ declare module "stream" {
1224
1228
  function duplexPair(options?: DuplexOptions): [Duplex, Duplex];
1225
1229
  type TransformCallback = (error?: Error | null, data?: any) => void;
1226
1230
  interface TransformOptions<T extends Transform = Transform> extends DuplexOptions<T> {
1227
- transform?(this: T, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1228
- flush?(this: T, callback: TransformCallback): void;
1231
+ transform?:
1232
+ | ((this: T, chunk: any, encoding: BufferEncoding, callback: TransformCallback) => void)
1233
+ | undefined;
1234
+ flush?: ((this: T, callback: TransformCallback) => void) | undefined;
1229
1235
  }
1230
1236
  /**
1231
1237
  * Transform streams are `Duplex` streams where the output is in some way
@@ -1632,6 +1638,7 @@ declare module "stream" {
1632
1638
  ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
1633
1639
  ): Promise<void>;
1634
1640
  }
1641
+ // TODO: this interface never existed; remove in next major
1635
1642
  interface Pipe {
1636
1643
  close(): void;
1637
1644
  hasRef(): boolean;
node v22.18/tls.d.ts CHANGED
@@ -586,7 +586,7 @@ declare module "tls" {
586
586
  * requires explicitly specifying a cipher suite with the `ciphers` option.
587
587
  * More information can be found in the RFC 4279.
588
588
  */
589
- pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
589
+ pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined;
590
590
  /**
591
591
  * hint to send to a client to help
592
592
  * with selecting the identity during TLS-PSK negotiation. Will be ignored
@@ -627,7 +627,7 @@ declare module "tls" {
627
627
  * compatible with the selected cipher's digest.
628
628
  * `identity` must use UTF-8 encoding.
629
629
  */
630
- pskCallback?(hint: string | null): PSKCallbackNegotation | null;
630
+ pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
631
631
  }
632
632
  /**
633
633
  * Accepts encrypted connections using TLS or SSL.
node v22.18/v8.d.ts CHANGED
@@ -43,12 +43,12 @@ declare module "v8" {
43
43
  * If true, expose internals in the heap snapshot.
44
44
  * @default false
45
45
  */
46
- exposeInternals?: boolean;
46
+ exposeInternals?: boolean | undefined;
47
47
  /**
48
48
  * If true, expose numeric values in artificial fields.
49
49
  * @default false
50
50
  */
51
- exposeNumericValues?: boolean;
51
+ exposeNumericValues?: boolean | undefined;
52
52
  }
53
53
  /**
54
54
  * Returns an integer representing a version tag derived from the V8 version,
node v22.18/vm.d.ts CHANGED
@@ -97,28 +97,22 @@ declare module "vm" {
97
97
  */
98
98
  breakOnSigint?: boolean | undefined;
99
99
  }
100
- interface RunningScriptInNewContextOptions extends RunningScriptOptions {
100
+ interface RunningScriptInNewContextOptions
101
+ extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
102
+ {
101
103
  /**
102
104
  * Human-readable name of the newly created context.
103
105
  */
104
- contextName?: CreateContextOptions["name"];
106
+ contextName?: CreateContextOptions["name"] | undefined;
105
107
  /**
106
108
  * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
107
109
  * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
108
110
  * Most notably, this string should omit the trailing slash, as that denotes a path.
109
111
  */
110
- contextOrigin?: CreateContextOptions["origin"];
111
- contextCodeGeneration?: CreateContextOptions["codeGeneration"];
112
- /**
113
- * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
114
- */
115
- microtaskMode?: CreateContextOptions["microtaskMode"];
112
+ contextOrigin?: CreateContextOptions["origin"] | undefined;
113
+ contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
116
114
  }
117
- interface RunningCodeOptions extends RunningScriptOptions {
118
- /**
119
- * Provides an optional data with V8's code cache data for the supplied source.
120
- */
121
- cachedData?: ScriptOptions["cachedData"] | undefined;
115
+ interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
122
116
  /**
123
117
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
124
118
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
@@ -129,11 +123,9 @@ declare module "vm" {
129
123
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
130
124
  | undefined;
131
125
  }
132
- interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
133
- /**
134
- * Provides an optional data with V8's code cache data for the supplied source.
135
- */
136
- cachedData?: ScriptOptions["cachedData"] | undefined;
126
+ interface RunningCodeInNewContextOptions
127
+ extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
128
+ {
137
129
  /**
138
130
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
139
131
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
@@ -144,16 +136,7 @@ declare module "vm" {
144
136
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
145
137
  | undefined;
146
138
  }
147
- interface CompileFunctionOptions extends BaseOptions {
148
- /**
149
- * Provides an optional data with V8's code cache data for the supplied source.
150
- */
151
- cachedData?: ScriptOptions["cachedData"] | undefined;
152
- /**
153
- * Specifies whether to produce new cache data.
154
- * @default false
155
- */
156
- produceCachedData?: boolean | undefined;
139
+ interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
157
140
  /**
158
141
  * The sandbox/context in which the said function should be compiled in.
159
142
  */
@@ -380,15 +363,15 @@ declare module "vm" {
380
363
  */
381
364
  createCachedData(): Buffer;
382
365
  /** @deprecated in favor of `script.createCachedData()` */
383
- cachedDataProduced?: boolean | undefined;
366
+ cachedDataProduced?: boolean;
384
367
  /**
385
368
  * When `cachedData` is supplied to create the `vm.Script`, this value will be set
386
369
  * to either `true` or `false` depending on acceptance of the data by V8.
387
370
  * Otherwise the value is `undefined`.
388
371
  * @since v5.7.0
389
372
  */
390
- cachedDataRejected?: boolean | undefined;
391
- cachedData?: Buffer | undefined;
373
+ cachedDataRejected?: boolean;
374
+ cachedData?: Buffer;
392
375
  /**
393
376
  * When the script is compiled from a source that contains a source map magic
394
377
  * comment, this property will be set to the URL of the source map.
@@ -406,7 +389,7 @@ declare module "vm" {
406
389
  * ```
407
390
  * @since v19.1.0, v18.13.0
408
391
  */
409
- sourceMapURL?: string | undefined;
392
+ sourceMapURL: string | undefined;
410
393
  }
411
394
  /**
412
395
  * If the given `contextObject` is an object, the `vm.createContext()` method will
@@ -616,11 +599,7 @@ declare module "vm" {
616
599
  code: string,
617
600
  params?: readonly string[],
618
601
  options?: CompileFunctionOptions,
619
- ): Function & {
620
- cachedData?: Script["cachedData"] | undefined;
621
- cachedDataProduced?: Script["cachedDataProduced"] | undefined;
622
- cachedDataRejected?: Script["cachedDataRejected"] | undefined;
623
- };
602
+ ): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
624
603
  /**
625
604
  * Measure the memory known to V8 and used by all contexts known to the
626
605
  * current V8 isolate, or the main context.
@@ -677,10 +656,7 @@ declare module "vm" {
677
656
  * @experimental
678
657
  */
679
658
  function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
680
- interface ModuleEvaluateOptions {
681
- timeout?: RunningScriptOptions["timeout"] | undefined;
682
- breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
683
- }
659
+ interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
684
660
  type ModuleLinker = (
685
661
  specifier: string,
686
662
  referencingModule: Module,
@@ -887,19 +863,13 @@ declare module "vm" {
887
863
  */
888
864
  link(linker: ModuleLinker): Promise<void>;
889
865
  }
890
- interface SourceTextModuleOptions {
866
+ interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
891
867
  /**
892
868
  * String used in stack traces.
893
869
  * @default 'vm:module(i)' where i is a context-specific ascending index.
894
870
  */
895
871
  identifier?: string | undefined;
896
- /**
897
- * Provides an optional data with V8's code cache data for the supplied source.
898
- */
899
- cachedData?: ScriptOptions["cachedData"] | undefined;
900
872
  context?: Context | undefined;
901
- lineOffset?: BaseOptions["lineOffset"] | undefined;
902
- columnOffset?: BaseOptions["columnOffset"] | undefined;
903
873
  /**
904
874
  * Called during evaluation of this module to initialize the `import.meta`.
905
875
  */