@types/node 24.5.1 → 24.6.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: Tue, 16 Sep 2025 21:32:23 GMT
11
+ * Last updated: Mon, 29 Sep 2025 18:40:16 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/assert/strict.d.ts CHANGED
@@ -1,8 +1,111 @@
1
+ /**
2
+ * In strict assertion mode, non-strict methods behave like their corresponding
3
+ * strict methods. For example, `assert.deepEqual()` will behave like
4
+ * `assert.deepStrictEqual()`.
5
+ *
6
+ * In strict assertion mode, error messages for objects display a diff. In legacy
7
+ * assertion mode, error messages for objects display the objects, often truncated.
8
+ *
9
+ * To use strict assertion mode:
10
+ *
11
+ * ```js
12
+ * import { strict as assert } from 'node:assert';
13
+ * ```
14
+ *
15
+ * ```js
16
+ * import assert from 'node:assert/strict';
17
+ * ```
18
+ *
19
+ * Example error diff:
20
+ *
21
+ * ```js
22
+ * import { strict as assert } from 'node:assert';
23
+ *
24
+ * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
25
+ * // AssertionError: Expected inputs to be strictly deep-equal:
26
+ * // + actual - expected ... Lines skipped
27
+ * //
28
+ * // [
29
+ * // [
30
+ * // ...
31
+ * // 2,
32
+ * // + 3
33
+ * // - '3'
34
+ * // ],
35
+ * // ...
36
+ * // 5
37
+ * // ]
38
+ * ```
39
+ *
40
+ * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
41
+ * environment variables. This will also deactivate the colors in the REPL. For
42
+ * more on color support in terminal environments, read the tty
43
+ * [`getColorDepth()`](https://nodejs.org/docs/latest-v24.x/api/tty.html#writestreamgetcolordepthenv) documentation.
44
+ * @since v15.0.0
45
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert/strict.js)
46
+ */
1
47
  declare module "assert/strict" {
2
- import { strict } from "node:assert";
48
+ import {
49
+ Assert,
50
+ AssertionError,
51
+ AssertionErrorOptions,
52
+ AssertOptions,
53
+ AssertPredicate,
54
+ AssertStrict,
55
+ CallTracker,
56
+ CallTrackerCall,
57
+ CallTrackerReportInformation,
58
+ deepStrictEqual,
59
+ doesNotMatch,
60
+ doesNotReject,
61
+ doesNotThrow,
62
+ fail,
63
+ ifError,
64
+ match,
65
+ notDeepStrictEqual,
66
+ notStrictEqual,
67
+ ok,
68
+ partialDeepStrictEqual,
69
+ rejects,
70
+ strictEqual,
71
+ throws,
72
+ } from "node:assert";
73
+ function strict(value: unknown, message?: string | Error): asserts value;
74
+ namespace strict {
75
+ export {
76
+ Assert,
77
+ AssertionError,
78
+ AssertionErrorOptions,
79
+ AssertOptions,
80
+ AssertPredicate,
81
+ AssertStrict,
82
+ CallTracker,
83
+ CallTrackerCall,
84
+ CallTrackerReportInformation,
85
+ deepStrictEqual,
86
+ deepStrictEqual as deepEqual,
87
+ doesNotMatch,
88
+ doesNotReject,
89
+ doesNotThrow,
90
+ fail,
91
+ ifError,
92
+ match,
93
+ notDeepStrictEqual,
94
+ notDeepStrictEqual as notDeepEqual,
95
+ notStrictEqual,
96
+ notStrictEqual as notEqual,
97
+ ok,
98
+ partialDeepStrictEqual,
99
+ rejects,
100
+ strict,
101
+ strictEqual,
102
+ strictEqual as equal,
103
+ throws,
104
+ };
105
+ }
3
106
  export = strict;
4
107
  }
5
108
  declare module "node:assert/strict" {
6
- import { strict } from "node:assert";
109
+ import strict = require("assert/strict");
7
110
  export = strict;
8
111
  }
node/assert.d.ts CHANGED
@@ -4,17 +4,128 @@
4
4
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert.js)
5
5
  */
6
6
  declare module "assert" {
7
+ import strict = require("assert/strict");
7
8
  /**
8
- * An alias of {@link ok}.
9
+ * An alias of {@link assert.ok}.
9
10
  * @since v0.5.9
10
11
  * @param value The input that is checked for being truthy.
11
12
  */
12
13
  function assert(value: unknown, message?: string | Error): asserts value;
14
+ const kOptions: unique symbol;
13
15
  namespace assert {
16
+ type AssertMethodNames =
17
+ | "deepEqual"
18
+ | "deepStrictEqual"
19
+ | "doesNotMatch"
20
+ | "doesNotReject"
21
+ | "doesNotThrow"
22
+ | "equal"
23
+ | "fail"
24
+ | "ifError"
25
+ | "match"
26
+ | "notDeepEqual"
27
+ | "notDeepStrictEqual"
28
+ | "notEqual"
29
+ | "notStrictEqual"
30
+ | "ok"
31
+ | "partialDeepStrictEqual"
32
+ | "rejects"
33
+ | "strictEqual"
34
+ | "throws";
35
+ interface AssertOptions {
36
+ /**
37
+ * If set to `'full'`, shows the full diff in assertion errors.
38
+ * @default 'simple'
39
+ */
40
+ diff?: "simple" | "full" | undefined;
41
+ /**
42
+ * If set to `true`, non-strict methods behave like their
43
+ * corresponding strict methods.
44
+ * @default true
45
+ */
46
+ strict?: boolean | undefined;
47
+ }
48
+ interface Assert extends Pick<typeof assert, AssertMethodNames> {
49
+ readonly [kOptions]: AssertOptions & { strict: false };
50
+ }
51
+ interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
52
+ readonly [kOptions]: AssertOptions & { strict: true };
53
+ }
54
+ /**
55
+ * The `Assert` class allows creating independent assertion instances with custom options.
56
+ * @since v24.6.0
57
+ */
58
+ var Assert: {
59
+ /**
60
+ * Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
61
+ *
62
+ * ```js
63
+ * const { Assert } = require('node:assert');
64
+ * const assertInstance = new Assert({ diff: 'full' });
65
+ * assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
66
+ * // Shows a full diff in the error message.
67
+ * ```
68
+ *
69
+ * **Important**: When destructuring assertion methods from an `Assert` instance,
70
+ * the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings).
71
+ * The destructured methods will fall back to default behavior instead.
72
+ *
73
+ * ```js
74
+ * const myAssert = new Assert({ diff: 'full' });
75
+ *
76
+ * // This works as expected - uses 'full' diff
77
+ * myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
78
+ *
79
+ * // This loses the 'full' diff setting - falls back to default 'simple' diff
80
+ * const { strictEqual } = myAssert;
81
+ * strictEqual({ a: 1 }, { b: { c: 1 } });
82
+ * ```
83
+ *
84
+ * When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
85
+ * (diff: 'simple', non-strict mode).
86
+ * To maintain custom options when using destructured methods, avoid
87
+ * destructuring and call methods directly on the instance.
88
+ * @since v24.6.0
89
+ */
90
+ new(
91
+ options?: AssertOptions & { strict?: true },
92
+ ): AssertStrict;
93
+ new(
94
+ options: AssertOptions,
95
+ ): Assert;
96
+ };
97
+ interface AssertionErrorOptions {
98
+ /**
99
+ * If provided, the error message is set to this value.
100
+ */
101
+ message?: string | undefined;
102
+ /**
103
+ * The `actual` property on the error instance.
104
+ */
105
+ actual?: unknown;
106
+ /**
107
+ * The `expected` property on the error instance.
108
+ */
109
+ expected?: unknown;
110
+ /**
111
+ * The `operator` property on the error instance.
112
+ */
113
+ operator?: string | undefined;
114
+ /**
115
+ * If provided, the generated stack trace omits frames before this function.
116
+ */
117
+ stackStartFn?: Function | undefined;
118
+ /**
119
+ * If set to `'full'`, shows the full diff in assertion errors.
120
+ * @default 'simple'
121
+ */
122
+ diff?: "simple" | "full" | undefined;
123
+ }
14
124
  /**
15
125
  * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
16
126
  */
17
127
  class AssertionError extends Error {
128
+ constructor(options: AssertionErrorOptions);
18
129
  /**
19
130
  * Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
20
131
  */
@@ -23,10 +134,6 @@ declare module "assert" {
23
134
  * Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
24
135
  */
25
136
  expected: unknown;
26
- /**
27
- * Set to the passed in operator value.
28
- */
29
- operator: string;
30
137
  /**
31
138
  * Indicates if the message was auto-generated (`true`) or not.
32
139
  */
@@ -35,19 +142,10 @@ declare module "assert" {
35
142
  * Value is always `ERR_ASSERTION` to show that the error is an assertion error.
36
143
  */
37
144
  code: "ERR_ASSERTION";
38
- constructor(options?: {
39
- /** If provided, the error message is set to this value. */
40
- message?: string | undefined;
41
- /** The `actual` property on the error instance. */
42
- actual?: unknown | undefined;
43
- /** The `expected` property on the error instance. */
44
- expected?: unknown | undefined;
45
- /** The `operator` property on the error instance. */
46
- operator?: string | undefined;
47
- /** If provided, the generated stack trace omits frames before this function. */
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
49
- stackStartFn?: Function | undefined;
50
- });
145
+ /**
146
+ * Set to the passed in operator value.
147
+ */
148
+ operator: string;
51
149
  }
52
150
  /**
53
151
  * This feature is deprecated and will be removed in a future version.
@@ -970,83 +1068,9 @@ declare module "assert" {
970
1068
  * @since v22.13.0
971
1069
  */
972
1070
  function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
973
- /**
974
- * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
975
- * {@link deepEqual} will behave like {@link deepStrictEqual}.
976
- *
977
- * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
978
- * messages for objects display the objects, often truncated.
979
- *
980
- * To use strict assertion mode:
981
- *
982
- * ```js
983
- * import { strict as assert } from 'node:assert';
984
- * import assert from 'node:assert/strict';
985
- * ```
986
- *
987
- * Example error diff:
988
- *
989
- * ```js
990
- * import { strict as assert } from 'node:assert';
991
- *
992
- * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
993
- * // AssertionError: Expected inputs to be strictly deep-equal:
994
- * // + actual - expected ... Lines skipped
995
- * //
996
- * // [
997
- * // [
998
- * // ...
999
- * // 2,
1000
- * // + 3
1001
- * // - '3'
1002
- * // ],
1003
- * // ...
1004
- * // 5
1005
- * // ]
1006
- * ```
1007
- *
1008
- * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
1009
- * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
1010
- * `getColorDepth()` documentation.
1011
- *
1012
- * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
1013
- */
1014
- namespace strict {
1015
- type AssertionError = assert.AssertionError;
1016
- type AssertPredicate = assert.AssertPredicate;
1017
- type CallTrackerCall = assert.CallTrackerCall;
1018
- type CallTrackerReportInformation = assert.CallTrackerReportInformation;
1019
- }
1020
- const strict:
1021
- & Omit<
1022
- typeof assert,
1023
- | "equal"
1024
- | "notEqual"
1025
- | "deepEqual"
1026
- | "notDeepEqual"
1027
- | "ok"
1028
- | "strictEqual"
1029
- | "deepStrictEqual"
1030
- | "ifError"
1031
- | "strict"
1032
- | "AssertionError"
1033
- >
1034
- & {
1035
- (value: unknown, message?: string | Error): asserts value;
1036
- equal: typeof strictEqual;
1037
- notEqual: typeof notStrictEqual;
1038
- deepEqual: typeof deepStrictEqual;
1039
- notDeepEqual: typeof notDeepStrictEqual;
1040
- // Mapped types and assertion functions are incompatible?
1041
- // TS2775: Assertions require every name in the call target
1042
- // to be declared with an explicit type annotation.
1043
- ok: typeof ok;
1044
- strictEqual: typeof strictEqual;
1045
- deepStrictEqual: typeof deepStrictEqual;
1046
- ifError: typeof ifError;
1047
- strict: typeof strict;
1048
- AssertionError: typeof AssertionError;
1049
- };
1071
+ }
1072
+ namespace assert {
1073
+ export { strict };
1050
1074
  }
1051
1075
  export = assert;
1052
1076
  }
node/crypto.d.ts CHANGED
@@ -603,6 +603,9 @@ declare module "crypto" {
603
603
  * * `'ed25519'` (OID 1.3.101.112)
604
604
  * * `'ed448'` (OID 1.3.101.113)
605
605
  * * `'dh'` (OID 1.2.840.113549.1.3.1)
606
+ * * `'ml-dsa-44'` (OID 2.16.840.1.101.3.4.3.17)
607
+ * * `'ml-dsa-65'` (OID 2.16.840.1.101.3.4.3.18)
608
+ * * `'ml-dsa-87'` (OID 2.16.840.1.101.3.4.3.19)
606
609
  *
607
610
  * This property is `undefined` for unrecognized `KeyObject` types and symmetric
608
611
  * keys.
@@ -2456,7 +2459,18 @@ declare module "crypto" {
2456
2459
  * @since v6.6.0
2457
2460
  */
2458
2461
  function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2459
- type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
2462
+ type KeyType =
2463
+ | "rsa"
2464
+ | "rsa-pss"
2465
+ | "dsa"
2466
+ | "ec"
2467
+ | "ed25519"
2468
+ | "ed448"
2469
+ | "x25519"
2470
+ | "x448"
2471
+ | "ml-dsa-44"
2472
+ | "ml-dsa-65"
2473
+ | "ml-dsa-87";
2460
2474
  type KeyFormat = "pem" | "der" | "jwk";
2461
2475
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2462
2476
  format: T;
@@ -2471,6 +2485,7 @@ declare module "crypto" {
2471
2485
  interface ED448KeyPairKeyObjectOptions {}
2472
2486
  interface X25519KeyPairKeyObjectOptions {}
2473
2487
  interface X448KeyPairKeyObjectOptions {}
2488
+ interface MLDSAKeyPairKeyObjectOptions {}
2474
2489
  interface ECKeyPairKeyObjectOptions {
2475
2490
  /**
2476
2491
  * Name of the curve to use
@@ -2635,13 +2650,22 @@ declare module "crypto" {
2635
2650
  type: "pkcs8";
2636
2651
  };
2637
2652
  }
2653
+ interface MLDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2654
+ publicKeyEncoding: {
2655
+ type: "spki";
2656
+ format: PubF;
2657
+ };
2658
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2659
+ type: "pkcs8";
2660
+ };
2661
+ }
2638
2662
  interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
2639
2663
  publicKey: T1;
2640
2664
  privateKey: T2;
2641
2665
  }
2642
2666
  /**
2643
2667
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2644
- * Ed25519, Ed448, X25519, X448, and DH are currently supported.
2668
+ * Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
2645
2669
  *
2646
2670
  * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2647
2671
  * behaves as if `keyObject.export()` had been called on its result. Otherwise,
@@ -2678,7 +2702,8 @@ declare module "crypto" {
2678
2702
  * When PEM encoding was selected, the respective key will be a string, otherwise
2679
2703
  * it will be a buffer containing the data encoded as DER.
2680
2704
  * @since v10.12.0
2681
- * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2705
+ * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`,
2706
+ * `'ed448'`, `'x25519'`, `'x448'`, `'dh'`, `'ml-dsa-44'`, `'ml-dsa-65'`, or `'ml-dsa-87'`.
2682
2707
  */
2683
2708
  function generateKeyPairSync(
2684
2709
  type: "rsa",
@@ -2816,6 +2841,26 @@ declare module "crypto" {
2816
2841
  options: X448KeyPairOptions<"der", "der">,
2817
2842
  ): KeyPairSyncResult<Buffer, Buffer>;
2818
2843
  function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2844
+ function generateKeyPairSync(
2845
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2846
+ options: MLDSAKeyPairOptions<"pem", "pem">,
2847
+ ): KeyPairSyncResult<string, string>;
2848
+ function generateKeyPairSync(
2849
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2850
+ options: MLDSAKeyPairOptions<"pem", "der">,
2851
+ ): KeyPairSyncResult<string, Buffer>;
2852
+ function generateKeyPairSync(
2853
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2854
+ options: MLDSAKeyPairOptions<"der", "pem">,
2855
+ ): KeyPairSyncResult<Buffer, string>;
2856
+ function generateKeyPairSync(
2857
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2858
+ options: MLDSAKeyPairOptions<"der", "der">,
2859
+ ): KeyPairSyncResult<Buffer, Buffer>;
2860
+ function generateKeyPairSync(
2861
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2862
+ options?: MLDSAKeyPairKeyObjectOptions,
2863
+ ): KeyPairKeyObjectResult;
2819
2864
  /**
2820
2865
  * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2821
2866
  * Ed25519, Ed448, X25519, X448, and DH are currently supported.
@@ -2853,7 +2898,8 @@ declare module "crypto" {
2853
2898
  * If this method is invoked as its `util.promisify()` ed version, it returns
2854
2899
  * a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
2855
2900
  * @since v10.12.0
2856
- * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2901
+ * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`,
2902
+ * `'ed448'`, `'x25519'`, `'x448'`, `'dh'`, `'ml-dsa-44'`, `'ml-dsa-65'`, or `'ml-dsa-87'`.
2857
2903
  */
2858
2904
  function generateKeyPair(
2859
2905
  type: "rsa",
@@ -3055,6 +3101,31 @@ declare module "crypto" {
3055
3101
  options: X448KeyPairKeyObjectOptions | undefined,
3056
3102
  callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3057
3103
  ): void;
3104
+ function generateKeyPair(
3105
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3106
+ options: MLDSAKeyPairOptions<"pem", "pem">,
3107
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
3108
+ ): void;
3109
+ function generateKeyPair(
3110
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3111
+ options: MLDSAKeyPairOptions<"pem", "der">,
3112
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3113
+ ): void;
3114
+ function generateKeyPair(
3115
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3116
+ options: MLDSAKeyPairOptions<"der", "pem">,
3117
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3118
+ ): void;
3119
+ function generateKeyPair(
3120
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3121
+ options: MLDSAKeyPairOptions<"der", "der">,
3122
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3123
+ ): void;
3124
+ function generateKeyPair(
3125
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3126
+ options: MLDSAKeyPairKeyObjectOptions | undefined,
3127
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
3128
+ ): void;
3058
3129
  namespace generateKeyPair {
3059
3130
  function __promisify__(
3060
3131
  type: "rsa",
@@ -3297,11 +3368,46 @@ declare module "crypto" {
3297
3368
  privateKey: Buffer;
3298
3369
  }>;
3299
3370
  function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3371
+ function __promisify__(
3372
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3373
+ options: MLDSAKeyPairOptions<"pem", "pem">,
3374
+ ): Promise<{
3375
+ publicKey: string;
3376
+ privateKey: string;
3377
+ }>;
3378
+ function __promisify__(
3379
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3380
+ options: MLDSAKeyPairOptions<"pem", "der">,
3381
+ ): Promise<{
3382
+ publicKey: string;
3383
+ privateKey: Buffer;
3384
+ }>;
3385
+ function __promisify__(
3386
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3387
+ options: MLDSAKeyPairOptions<"der", "pem">,
3388
+ ): Promise<{
3389
+ publicKey: Buffer;
3390
+ privateKey: string;
3391
+ }>;
3392
+ function __promisify__(
3393
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3394
+ options: MLDSAKeyPairOptions<"der", "der">,
3395
+ ): Promise<{
3396
+ publicKey: Buffer;
3397
+ privateKey: Buffer;
3398
+ }>;
3399
+ function __promisify__(
3400
+ type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3401
+ options?: MLDSAKeyPairKeyObjectOptions,
3402
+ ): Promise<KeyPairKeyObjectResult>;
3300
3403
  }
3301
3404
  /**
3302
3405
  * Calculates and returns the signature for `data` using the given private key and
3303
3406
  * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
3304
- * dependent upon the key type (especially Ed25519 and Ed448).
3407
+ * dependent upon the key type.
3408
+ *
3409
+ * `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
3410
+ * ML-DSA.
3305
3411
  *
3306
3412
  * If `key` is not a `KeyObject`, this function behaves as if `key` had been
3307
3413
  * passed to {@link createPrivateKey}. If it is an object, the following
@@ -3322,8 +3428,12 @@ declare module "crypto" {
3322
3428
  callback: (error: Error | null, data: Buffer) => void,
3323
3429
  ): void;
3324
3430
  /**
3325
- * Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
3326
- * key type (especially Ed25519 and Ed448).
3431
+ * Verifies the given signature for `data` using the given key and algorithm. If
3432
+ * `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
3433
+ * key type.
3434
+ *
3435
+ * `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
3436
+ * ML-DSA.
3327
3437
  *
3328
3438
  * If `key` is not a `KeyObject`, this function behaves as if `key` had been
3329
3439
  * passed to {@link createPublicKey}. If it is an object, the following
node/events.d.ts CHANGED
@@ -584,6 +584,85 @@ declare module "events" {
584
584
  */
585
585
  readonly asyncResource: EventEmitterReferencingAsyncResource;
586
586
  }
587
+ /**
588
+ * The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
589
+ * that emulates a subset of the `EventEmitter` API.
590
+ * @since v14.5.0
591
+ */
592
+ export interface NodeEventTarget extends EventTarget {
593
+ /**
594
+ * Node.js-specific extension to the `EventTarget` class that emulates the
595
+ * equivalent `EventEmitter` API. The only difference between `addListener()` and
596
+ * `addEventListener()` is that `addListener()` will return a reference to the
597
+ * `EventTarget`.
598
+ * @since v14.5.0
599
+ */
600
+ addListener(type: string, listener: (arg: any) => void): this;
601
+ /**
602
+ * Node.js-specific extension to the `EventTarget` class that dispatches the
603
+ * `arg` to the list of handlers for `type`.
604
+ * @since v15.2.0
605
+ * @returns `true` if event listeners registered for the `type` exist,
606
+ * otherwise `false`.
607
+ */
608
+ emit(type: string, arg: any): boolean;
609
+ /**
610
+ * Node.js-specific extension to the `EventTarget` class that returns an array
611
+ * of event `type` names for which event listeners are registered.
612
+ * @since 14.5.0
613
+ */
614
+ eventNames(): string[];
615
+ /**
616
+ * Node.js-specific extension to the `EventTarget` class that returns the number
617
+ * of event listeners registered for the `type`.
618
+ * @since v14.5.0
619
+ */
620
+ listenerCount(type: string): number;
621
+ /**
622
+ * Node.js-specific extension to the `EventTarget` class that sets the number
623
+ * of max event listeners as `n`.
624
+ * @since v14.5.0
625
+ */
626
+ setMaxListeners(n: number): void;
627
+ /**
628
+ * Node.js-specific extension to the `EventTarget` class that returns the number
629
+ * of max event listeners.
630
+ * @since v14.5.0
631
+ */
632
+ getMaxListeners(): number;
633
+ /**
634
+ * Node.js-specific alias for `eventTarget.removeEventListener()`.
635
+ * @since v14.5.0
636
+ */
637
+ off(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
638
+ /**
639
+ * Node.js-specific alias for `eventTarget.addEventListener()`.
640
+ * @since v14.5.0
641
+ */
642
+ on(type: string, listener: (arg: any) => void): this;
643
+ /**
644
+ * Node.js-specific extension to the `EventTarget` class that adds a `once`
645
+ * listener for the given event `type`. This is equivalent to calling `on`
646
+ * with the `once` option set to `true`.
647
+ * @since v14.5.0
648
+ */
649
+ once(type: string, listener: (arg: any) => void): this;
650
+ /**
651
+ * Node.js-specific extension to the `EventTarget` class. If `type` is specified,
652
+ * removes all registered listeners for `type`, otherwise removes all registered
653
+ * listeners.
654
+ * @since v14.5.0
655
+ */
656
+ removeAllListeners(type?: string): this;
657
+ /**
658
+ * Node.js-specific extension to the `EventTarget` class that removes the
659
+ * `listener` for the given `type`. The only difference between `removeListener()`
660
+ * and `removeEventListener()` is that `removeListener()` will return a reference
661
+ * to the `EventTarget`.
662
+ * @since v14.5.0
663
+ */
664
+ removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
665
+ }
587
666
  }
588
667
  global {
589
668
  namespace NodeJS {
node/fs.d.ts CHANGED
@@ -450,6 +450,230 @@ declare module "fs" {
450
450
  prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
451
451
  prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
452
452
  }
453
+ export interface Utf8StreamOptions {
454
+ /**
455
+ * Appends writes to dest file instead of truncating it.
456
+ * @default true
457
+ */
458
+ append?: boolean | undefined;
459
+ /**
460
+ * Which type of data you can send to the write
461
+ * function, supported values are `'utf8'` or `'buffer'`.
462
+ * @default 'utf8'
463
+ */
464
+ contentMode?: "utf8" | "buffer" | undefined;
465
+ /**
466
+ * A path to a file to be written to (mode controlled by the
467
+ * append option).
468
+ */
469
+ dest?: string | undefined;
470
+ /**
471
+ * A file descriptor, something that is returned by `fs.open()`
472
+ * or `fs.openSync()`.
473
+ */
474
+ fd?: number | undefined;
475
+ /**
476
+ * An object that has the same API as the `fs` module, useful
477
+ * for mocking, testing, or customizing the behavior of the stream.
478
+ */
479
+ fs?: object | undefined;
480
+ /**
481
+ * Perform a `fs.fsyncSync()` every time a write is
482
+ * completed.
483
+ */
484
+ fsync?: boolean | undefined;
485
+ /**
486
+ * The maximum length of the internal buffer. If a write
487
+ * operation would cause the buffer to exceed `maxLength`, the data written is
488
+ * dropped and a drop event is emitted with the dropped data
489
+ */
490
+ maxLength?: number | undefined;
491
+ /**
492
+ * The maximum number of bytes that can be written;
493
+ * @default 16384
494
+ */
495
+ maxWrite?: number | undefined;
496
+ /**
497
+ * The minimum length of the internal buffer that is
498
+ * required to be full before flushing.
499
+ */
500
+ minLength?: number | undefined;
501
+ /**
502
+ * Ensure directory for `dest` file exists when true.
503
+ * @default false
504
+ */
505
+ mkdir?: boolean | undefined;
506
+ /**
507
+ * Specify the creating file mode (see `fs.open()`).
508
+ */
509
+ mode?: number | string | undefined;
510
+ /**
511
+ * Calls flush every `periodicFlush` milliseconds.
512
+ */
513
+ periodicFlush?: number | undefined;
514
+ /**
515
+ * A function that will be called when `write()`,
516
+ * `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
517
+ * If the return value is `true` the operation will be retried, otherwise it
518
+ * will bubble the error. The `err` is the error that caused this function to
519
+ * be called, `writeBufferLen` is the length of the buffer that was written,
520
+ * and `remainingBufferLen` is the length of the remaining buffer that the
521
+ * stream did not try to write.
522
+ */
523
+ retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
524
+ /**
525
+ * Perform writes synchronously.
526
+ */
527
+ sync?: boolean | undefined;
528
+ }
529
+ /**
530
+ * An optimized UTF-8 stream writer that allows for flushing all the internal
531
+ * buffering on demand. It handles `EAGAIN` errors correctly, allowing for
532
+ * customization, for example, by dropping content if the disk is busy.
533
+ * @since v24.6.0
534
+ * @experimental
535
+ */
536
+ export class Utf8Stream extends EventEmitter {
537
+ constructor(options: Utf8StreamOptions);
538
+ /**
539
+ * Whether the stream is appending to the file or truncating it.
540
+ */
541
+ readonly append: boolean;
542
+ /**
543
+ * The type of data that can be written to the stream. Supported
544
+ * values are `'utf8'` or `'buffer'`.
545
+ * @default 'utf8'
546
+ */
547
+ readonly contentMode: "utf8" | "buffer";
548
+ /**
549
+ * Close the stream immediately, without flushing the internal buffer.
550
+ */
551
+ destroy(): void;
552
+ /**
553
+ * Close the stream gracefully, flushing the internal buffer before closing.
554
+ */
555
+ end(): void;
556
+ /**
557
+ * The file descriptor that is being written to.
558
+ */
559
+ readonly fd: number;
560
+ /**
561
+ * The file that is being written to.
562
+ */
563
+ readonly file: string;
564
+ /**
565
+ * Writes the current buffer to the file if a write was not in progress. Do
566
+ * nothing if `minLength` is zero or if it is already writing.
567
+ */
568
+ flush(callback: (err: Error | null) => void): void;
569
+ /**
570
+ * Flushes the buffered data synchronously. This is a costly operation.
571
+ */
572
+ flushSync(): void;
573
+ /**
574
+ * Whether the stream is performing a `fs.fsyncSync()` after every
575
+ * write operation.
576
+ */
577
+ readonly fsync: boolean;
578
+ /**
579
+ * The maximum length of the internal buffer. If a write
580
+ * operation would cause the buffer to exceed `maxLength`, the data written is
581
+ * dropped and a drop event is emitted with the dropped data.
582
+ */
583
+ readonly maxLength: number;
584
+ /**
585
+ * The minimum length of the internal buffer that is required to be
586
+ * full before flushing.
587
+ */
588
+ readonly minLength: number;
589
+ /**
590
+ * Whether the stream should ensure that the directory for the
591
+ * `dest` file exists. If `true`, it will create the directory if it does not
592
+ * exist.
593
+ * @default false
594
+ */
595
+ readonly mkdir: boolean;
596
+ /**
597
+ * The mode of the file that is being written to.
598
+ */
599
+ readonly mode: number | string;
600
+ /**
601
+ * The number of milliseconds between flushes. If set to `0`, no
602
+ * periodic flushes will be performed.
603
+ */
604
+ readonly periodicFlush: number;
605
+ /**
606
+ * Reopen the file in place, useful for log rotation.
607
+ * @param file A path to a file to be written to (mode
608
+ * controlled by the append option).
609
+ */
610
+ reopen(file: PathLike): void;
611
+ /**
612
+ * Whether the stream is writing synchronously or asynchronously.
613
+ */
614
+ readonly sync: boolean;
615
+ /**
616
+ * When the `options.contentMode` is set to `'utf8'` when the stream is created,
617
+ * the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
618
+ * the `data` argument must be a `Buffer`.
619
+ * @param data The data to write.
620
+ */
621
+ write(data: string | Buffer): boolean;
622
+ /**
623
+ * Whether the stream is currently writing data to the file.
624
+ */
625
+ readonly writing: boolean;
626
+ /**
627
+ * Calls `utf8Stream.destroy()`.
628
+ */
629
+ [Symbol.dispose](): void;
630
+ /**
631
+ * events.EventEmitter
632
+ * 1. change
633
+ * 2. close
634
+ * 3. error
635
+ */
636
+ addListener(event: "close", listener: () => void): this;
637
+ addListener(event: "drain", listener: () => void): this;
638
+ addListener(event: "drop", listener: (data: string | Buffer) => void): this;
639
+ addListener(event: "error", listener: (error: Error) => void): this;
640
+ addListener(event: "finish", listener: () => void): this;
641
+ addListener(event: "ready", listener: () => void): this;
642
+ addListener(event: "write", listener: (n: number) => void): this;
643
+ addListener(event: string, listener: (...args: any[]) => void): this;
644
+ on(event: "close", listener: () => void): this;
645
+ on(event: "drain", listener: () => void): this;
646
+ on(event: "drop", listener: (data: string | Buffer) => void): this;
647
+ on(event: "error", listener: (error: Error) => void): this;
648
+ on(event: "finish", listener: () => void): this;
649
+ on(event: "ready", listener: () => void): this;
650
+ on(event: "write", listener: (n: number) => void): this;
651
+ on(event: string, listener: (...args: any[]) => void): this;
652
+ once(event: "close", listener: () => void): this;
653
+ once(event: "drain", listener: () => void): this;
654
+ once(event: "drop", listener: (data: string | Buffer) => void): this;
655
+ once(event: "error", listener: (error: Error) => void): this;
656
+ once(event: "finish", listener: () => void): this;
657
+ once(event: "ready", listener: () => void): this;
658
+ once(event: "write", listener: (n: number) => void): this;
659
+ once(event: string, listener: (...args: any[]) => void): this;
660
+ prependListener(event: "close", listener: () => void): this;
661
+ prependListener(event: "drain", listener: () => void): this;
662
+ prependListener(event: "drop", listener: (data: string | Buffer) => void): this;
663
+ prependListener(event: "error", listener: (error: Error) => void): this;
664
+ prependListener(event: "finish", listener: () => void): this;
665
+ prependListener(event: "ready", listener: () => void): this;
666
+ prependListener(event: "write", listener: (n: number) => void): this;
667
+ prependListener(event: string, listener: (...args: any[]) => void): this;
668
+ prependOnceListener(event: "close", listener: () => void): this;
669
+ prependOnceListener(event: "drain", listener: () => void): this;
670
+ prependOnceListener(event: "drop", listener: (data: string | Buffer) => void): this;
671
+ prependOnceListener(event: "error", listener: (error: Error) => void): this;
672
+ prependOnceListener(event: "finish", listener: () => void): this;
673
+ prependOnceListener(event: "ready", listener: () => void): this;
674
+ prependOnceListener(event: "write", listener: (n: number) => void): this;
675
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
676
+ }
453
677
 
454
678
  /**
455
679
  * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
node/http.d.ts CHANGED
@@ -269,6 +269,13 @@ declare module "http" {
269
269
  * @since v18.0.0
270
270
  */
271
271
  keepAliveTimeout?: number | undefined;
272
+ /**
273
+ * An additional buffer time added to the
274
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
275
+ * @since 24.6.0
276
+ * @default 1000
277
+ */
278
+ keepAliveTimeoutBuffer?: number | undefined;
272
279
  /**
273
280
  * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
274
281
  * @default 30000
@@ -413,12 +420,18 @@ declare module "http" {
413
420
  /**
414
421
  * The number of milliseconds of inactivity a server needs to wait for additional
415
422
  * incoming data, after it has finished writing the last response, before a socket
416
- * will be destroyed. If the server receives new data before the keep-alive
417
- * timeout has fired, it will reset the regular inactivity timeout, i.e., `server.timeout`.
423
+ * will be destroyed.
424
+ *
425
+ * This timeout value is combined with the
426
+ * `server.keepAliveTimeoutBuffer` option to determine the actual socket
427
+ * timeout, calculated as:
428
+ * socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
429
+ * If the server receives new data before the keep-alive timeout has fired, it
430
+ * will reset the regular inactivity timeout, i.e., `server.timeout`.
418
431
  *
419
432
  * A value of `0` will disable the keep-alive timeout behavior on incoming
420
433
  * connections.
421
- * A value of `0` makes the http server behave similarly to Node.js versions prior
434
+ * A value of `0` makes the HTTP server behave similarly to Node.js versions prior
422
435
  * to 8.0.0, which did not have a keep-alive timeout.
423
436
  *
424
437
  * The socket timeout logic is set up on connection, so changing this value only
@@ -426,6 +439,18 @@ declare module "http" {
426
439
  * @since v8.0.0
427
440
  */
428
441
  keepAliveTimeout: number;
442
+ /**
443
+ * An additional buffer time added to the
444
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
445
+ *
446
+ * This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
447
+ * the socket timeout slightly beyond the advertised keep-alive timeout.
448
+ *
449
+ * This option applies only to new incoming connections.
450
+ * @since v24.6.0
451
+ * @default 1000
452
+ */
453
+ keepAliveTimeoutBuffer: number;
429
454
  /**
430
455
  * Sets the timeout value in milliseconds for receiving the entire request from
431
456
  * the client.
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "24.5.1",
3
+ "version": "24.6.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -147,9 +147,9 @@
147
147
  },
148
148
  "scripts": {},
149
149
  "dependencies": {
150
- "undici-types": "~7.12.0"
150
+ "undici-types": "~7.13.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "a75178555ac6bb4988973bb3fd7e3d6dfed50fe88cbe16c385e14646f513240e",
153
+ "typesPublisherContentHash": "c6b8073e736969ffdeaa3a20924802bc140d9c3e2953bb101d6da23c9409708b",
154
154
  "typeScriptVersion": "5.2"
155
155
  }
node/test.d.ts CHANGED
@@ -79,6 +79,7 @@
79
79
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test.js)
80
80
  */
81
81
  declare module "node:test" {
82
+ import { AssertMethodNames } from "node:assert";
82
83
  import { Readable } from "node:stream";
83
84
  import TestFn = test.TestFn;
84
85
  import TestOptions = test.TestOptions;
@@ -1171,29 +1172,7 @@ declare module "node:test" {
1171
1172
  */
1172
1173
  readonly mock: MockTracker;
1173
1174
  }
1174
- interface TestContextAssert extends
1175
- Pick<
1176
- typeof import("assert"),
1177
- | "deepEqual"
1178
- | "deepStrictEqual"
1179
- | "doesNotMatch"
1180
- | "doesNotReject"
1181
- | "doesNotThrow"
1182
- | "equal"
1183
- | "fail"
1184
- | "ifError"
1185
- | "match"
1186
- | "notDeepEqual"
1187
- | "notDeepStrictEqual"
1188
- | "notEqual"
1189
- | "notStrictEqual"
1190
- | "ok"
1191
- | "partialDeepStrictEqual"
1192
- | "rejects"
1193
- | "strictEqual"
1194
- | "throws"
1195
- >
1196
- {
1175
+ interface TestContextAssert extends Pick<typeof import("assert"), AssertMethodNames> {
1197
1176
  /**
1198
1177
  * This function serializes `value` and writes it to the file specified by `path`.
1199
1178
  *
node/util.d.ts CHANGED
@@ -338,6 +338,11 @@ declare module "util" {
338
338
  * @since v9.7.0
339
339
  */
340
340
  export function getSystemErrorName(err: number): string;
341
+ /**
342
+ * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.
343
+ * @since 24.6.0
344
+ */
345
+ export function setTraceSigInt(enable: boolean): void;
341
346
  /**
342
347
  * Returns a Map of all system error codes available from the Node.js API.
343
348
  * The mapping between error codes and error names is platform-dependent.
@@ -51,6 +51,7 @@ interface EventListenerObject {
51
51
  handleEvent(object: Event): void;
52
52
  }
53
53
 
54
+ type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
54
55
  interface EventListenerOptions {
55
56
  capture?: boolean;
56
57
  }
@@ -85,6 +86,8 @@ declare global {
85
86
  new(type: string, eventInitDict?: EventInit): Event;
86
87
  };
87
88
 
89
+ interface EventListenerOptions extends _EventListenerOptions {}
90
+
88
91
  interface EventTarget extends _EventTarget {}
89
92
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
90
93
  : {
node/worker_threads.d.ts CHANGED
@@ -56,19 +56,21 @@
56
56
  */
57
57
  declare module "worker_threads" {
58
58
  import { Context } from "node:vm";
59
- import { EventEmitter } from "node:events";
59
+ import { EventEmitter, NodeEventTarget } from "node:events";
60
60
  import { EventLoopUtilityFunction } from "node:perf_hooks";
61
61
  import { FileHandle } from "node:fs/promises";
62
62
  import { Readable, Writable } from "node:stream";
63
63
  import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
64
64
  import { URL } from "node:url";
65
65
  import { HeapInfo } from "node:v8";
66
+ import { MessageEvent } from "undici-types";
66
67
  const isInternalThread: boolean;
67
68
  const isMainThread: boolean;
68
69
  const parentPort: null | MessagePort;
69
70
  const resourceLimits: ResourceLimits;
70
71
  const SHARE_ENV: unique symbol;
71
72
  const threadId: number;
73
+ const threadName: string | null;
72
74
  const workerData: any;
73
75
  /**
74
76
  * Instances of the `worker.MessageChannel` class represent an asynchronous,
@@ -111,7 +113,7 @@ declare module "worker_threads" {
111
113
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
112
114
  * @since v10.5.0
113
115
  */
114
- class MessagePort extends EventEmitter {
116
+ class MessagePort extends EventTarget {
115
117
  /**
116
118
  * Disables further sending of messages on either side of the connection.
117
119
  * This method can be called when no further communication will happen over this `MessagePort`.
@@ -224,42 +226,32 @@ declare module "worker_threads" {
224
226
  * @since v10.5.0
225
227
  */
226
228
  start(): void;
227
- addListener(event: "close", listener: () => void): this;
229
+ addListener(event: "close", listener: (ev: Event) => void): this;
228
230
  addListener(event: "message", listener: (value: any) => void): this;
229
231
  addListener(event: "messageerror", listener: (error: Error) => void): this;
230
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
231
- emit(event: "close"): boolean;
232
+ addListener(event: string, listener: (arg: any) => void): this;
233
+ emit(event: "close", ev: Event): boolean;
232
234
  emit(event: "message", value: any): boolean;
233
235
  emit(event: "messageerror", error: Error): boolean;
234
- emit(event: string | symbol, ...args: any[]): boolean;
235
- on(event: "close", listener: () => void): this;
236
+ emit(event: string, arg: any): boolean;
237
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
238
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
239
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
240
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
241
+ on(event: "close", listener: (ev: Event) => void): this;
236
242
  on(event: "message", listener: (value: any) => void): this;
237
243
  on(event: "messageerror", listener: (error: Error) => void): this;
238
- on(event: string | symbol, listener: (...args: any[]) => void): this;
239
- once(event: "close", listener: () => void): this;
244
+ on(event: string, listener: (arg: any) => void): this;
245
+ once(event: "close", listener: (ev: Event) => void): this;
240
246
  once(event: "message", listener: (value: any) => void): this;
241
247
  once(event: "messageerror", listener: (error: Error) => void): this;
242
- once(event: string | symbol, listener: (...args: any[]) => void): this;
243
- prependListener(event: "close", listener: () => void): this;
244
- prependListener(event: "message", listener: (value: any) => void): this;
245
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
246
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
247
- prependOnceListener(event: "close", listener: () => void): this;
248
- prependOnceListener(event: "message", listener: (value: any) => void): this;
249
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
250
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
251
- removeListener(event: "close", listener: () => void): this;
252
- removeListener(event: "message", listener: (value: any) => void): this;
253
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
254
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
255
- off(event: "close", listener: () => void): this;
256
- off(event: "message", listener: (value: any) => void): this;
257
- off(event: "messageerror", listener: (error: Error) => void): this;
258
- off(event: string | symbol, listener: (...args: any[]) => void): this;
259
- addEventListener: EventTarget["addEventListener"];
260
- dispatchEvent: EventTarget["dispatchEvent"];
261
- removeEventListener: EventTarget["removeEventListener"];
248
+ once(event: string, listener: (arg: any) => void): this;
249
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
250
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
251
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
252
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
262
253
  }
254
+ interface MessagePort extends NodeEventTarget {}
263
255
  interface WorkerOptions {
264
256
  /**
265
257
  * List of arguments which would be stringified and appended to
@@ -401,6 +393,12 @@ declare module "worker_threads" {
401
393
  * @since v10.5.0
402
394
  */
403
395
  readonly threadId: number;
396
+ /**
397
+ * A string identifier for the referenced thread or null if the thread is not running.
398
+ * Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
399
+ * @since v24.6.0
400
+ */
401
+ readonly threadName: string | null;
404
402
  /**
405
403
  * Provides the set of JS engine resource constraints for this Worker thread.
406
404
  * If the `resourceLimits` option was passed to the `Worker` constructor,
@@ -428,24 +426,6 @@ declare module "worker_threads" {
428
426
  * @since v10.5.0
429
427
  */
430
428
  postMessage(value: any, transferList?: readonly Transferable[]): void;
431
- /**
432
- * Sends a value to another worker, identified by its thread ID.
433
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
434
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
435
- * @param value The value to send.
436
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
437
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
438
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
439
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
440
- * @since v22.5.0
441
- */
442
- postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
443
- postMessageToThread(
444
- threadId: number,
445
- value: any,
446
- transferList: readonly Transferable[],
447
- timeout?: number,
448
- ): Promise<void>;
449
429
  /**
450
430
  * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
451
431
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -465,6 +445,13 @@ declare module "worker_threads" {
465
445
  * @since v10.5.0
466
446
  */
467
447
  terminate(): Promise<number>;
448
+ /**
449
+ * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
450
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
451
+ * This methods allows the statistics to be observed from outside the actual thread.
452
+ * @since v24.6.0
453
+ */
454
+ cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
468
455
  /**
469
456
  * Returns a readable stream for a V8 snapshot of the current state of the Worker.
470
457
  * See `v8.getHeapSnapshot()` for more details.
@@ -574,18 +561,18 @@ declare module "worker_threads" {
574
561
  * ```
575
562
  * @since v15.4.0
576
563
  */
577
- class BroadcastChannel {
564
+ class BroadcastChannel extends EventTarget {
578
565
  readonly name: string;
579
566
  /**
580
567
  * Invoked with a single \`MessageEvent\` argument when a message is received.
581
568
  * @since v15.4.0
582
569
  */
583
- onmessage: (message: unknown) => void;
570
+ onmessage: (message: MessageEvent) => void;
584
571
  /**
585
572
  * Invoked with a received message cannot be deserialized.
586
573
  * @since v15.4.0
587
574
  */
588
- onmessageerror: (message: unknown) => void;
575
+ onmessageerror: (message: MessageEvent) => void;
589
576
  constructor(name: string);
590
577
  /**
591
578
  * Closes the `BroadcastChannel` connection.
node/zlib.d.ts CHANGED
@@ -180,6 +180,12 @@ declare module "zlib" {
180
180
  * If `true`, returns an object with `buffer` and `engine`.
181
181
  */
182
182
  info?: boolean | undefined;
183
+ /**
184
+ * Optional dictionary used to improve compression efficiency when compressing or decompressing data that
185
+ * shares common patterns with the dictionary.
186
+ * @since v24.6.0
187
+ */
188
+ dictionary?: NodeJS.ArrayBufferView | undefined;
183
189
  }
184
190
  interface Zlib {
185
191
  readonly bytesWritten: number;