@types/node 22.15.21 → 24.10.4
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 v24.10/README.md +15 -0
- node v24.10/assert/strict.d.ts +111 -0
- node/assert.d.ts → node v24.10/assert.d.ts +162 -101
- node/async_hooks.d.ts → node v24.10/async_hooks.d.ts +26 -6
- node/buffer.buffer.d.ts → node v24.10/buffer.buffer.d.ts +9 -0
- node/buffer.d.ts → node v24.10/buffer.d.ts +15 -7
- node/child_process.d.ts → node v24.10/child_process.d.ts +91 -164
- node/cluster.d.ts → node v24.10/cluster.d.ts +19 -20
- node/console.d.ts → node v24.10/console.d.ts +19 -18
- node/crypto.d.ts → node v24.10/crypto.d.ts +1264 -356
- node/dgram.d.ts → node v24.10/dgram.d.ts +10 -9
- node/diagnostics_channel.d.ts → node v24.10/diagnostics_channel.d.ts +18 -15
- node/dns/promises.d.ts → node v24.10/dns/promises.d.ts +36 -9
- node/dns.d.ts → node v24.10/dns.d.ts +95 -37
- node/domain.d.ts → node v24.10/domain.d.ts +1 -1
- node/events.d.ts → node v24.10/events.d.ts +81 -36
- node/fs/promises.d.ts → node v24.10/fs/promises.d.ts +104 -59
- node/fs.d.ts → node v24.10/fs.d.ts +414 -137
- node v24.10/globals.d.ts +170 -0
- node v24.10/globals.typedarray.d.ts +41 -0
- node/http.d.ts → node v24.10/http.d.ts +187 -37
- node/http2.d.ts → node v24.10/http2.d.ts +266 -67
- node/https.d.ts → node v24.10/https.d.ts +97 -63
- node/index.d.ts → node v24.10/index.d.ts +16 -7
- node v24.10/inspector.d.ts +277 -0
- node/inspector.d.ts → node v24.10/inspector.generated.d.ts +1059 -828
- node/module.d.ts → node v24.10/module.d.ts +153 -31
- node/net.d.ts → node v24.10/net.d.ts +35 -16
- node/os.d.ts → node v24.10/os.d.ts +22 -10
- node/package.json → node v24.10/package.json +14 -84
- node/path.d.ts → node v24.10/path.d.ts +2 -2
- node/perf_hooks.d.ts → node v24.10/perf_hooks.d.ts +30 -18
- node/process.d.ts → node v24.10/process.d.ts +45 -34
- node/punycode.d.ts → node v24.10/punycode.d.ts +1 -1
- node/querystring.d.ts → node v24.10/querystring.d.ts +1 -1
- node/readline/promises.d.ts → node v24.10/readline/promises.d.ts +1 -2
- node/readline.d.ts → node v24.10/readline.d.ts +13 -13
- node/repl.d.ts → node v24.10/repl.d.ts +25 -17
- node/sea.d.ts → node v24.10/sea.d.ts +10 -1
- node/sqlite.d.ts → node v24.10/sqlite.d.ts +438 -9
- node/stream/consumers.d.ts → node v24.10/stream/consumers.d.ts +2 -2
- node/stream/web.d.ts → node v24.10/stream/web.d.ts +13 -54
- node/stream.d.ts → node v24.10/stream.d.ts +68 -47
- node/string_decoder.d.ts → node v24.10/string_decoder.d.ts +3 -3
- node v24.10/test.d.ts +2339 -0
- node/timers/promises.d.ts → node v24.10/timers/promises.d.ts +1 -1
- node/timers.d.ts → node v24.10/timers.d.ts +1 -3
- node/tls.d.ts → node v24.10/tls.d.ts +124 -114
- node/trace_events.d.ts → node v24.10/trace_events.d.ts +6 -6
- node/ts5.6/buffer.buffer.d.ts → node v24.10/ts5.6/buffer.buffer.d.ts +10 -2
- node v24.10/ts5.6/compatibility/float16array.d.ts +71 -0
- node v24.10/ts5.6/globals.typedarray.d.ts +36 -0
- node/ts5.6/index.d.ts → node v24.10/ts5.6/index.d.ts +18 -7
- node v24.10/ts5.7/compatibility/float16array.d.ts +72 -0
- node v24.10/ts5.7/index.d.ts +103 -0
- node/tty.d.ts → node v24.10/tty.d.ts +1 -1
- node/url.d.ts → node v24.10/url.d.ts +119 -34
- node/util.d.ts → node v24.10/util.d.ts +46 -305
- node/v8.d.ts → node v24.10/v8.d.ts +100 -37
- node/vm.d.ts → node v24.10/vm.d.ts +299 -110
- node/wasi.d.ts → node v24.10/wasi.d.ts +23 -2
- node v24.10/web-globals/abortcontroller.d.ts +34 -0
- node v24.10/web-globals/crypto.d.ts +32 -0
- node v24.10/web-globals/domexception.d.ts +68 -0
- node v24.10/web-globals/events.d.ts +97 -0
- node v24.10/web-globals/fetch.d.ts +50 -0
- node v24.10/web-globals/navigator.d.ts +25 -0
- node v24.10/web-globals/storage.d.ts +24 -0
- node v24.10/web-globals/streams.d.ts +22 -0
- node/worker_threads.d.ts → node v24.10/worker_threads.d.ts +225 -75
- node/zlib.d.ts → node v24.10/zlib.d.ts +44 -33
- node/README.md +0 -15
- node/assert/strict.d.ts +0 -8
- node/compatibility/disposable.d.ts +0 -16
- node/compatibility/index.d.ts +0 -9
- node/compatibility/indexable.d.ts +0 -23
- node/dom-events.d.ts +0 -124
- node/globals.d.ts +0 -371
- node/globals.typedarray.d.ts +0 -21
- node/test.d.ts +0 -2280
- node/ts5.6/globals.typedarray.d.ts +0 -19
- {node → node v24.10}/LICENSE +0 -0
- {node → node v24.10}/compatibility/iterators.d.ts +0 -0
- {node → node v24.10}/constants.d.ts +0 -0
- {node → node v24.10}/stream/promises.d.ts +0 -0
node v24.10/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/node`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for node (https://nodejs.org/).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Sun, 14 Dec 2025 00:04:32 GMT
|
|
12
|
+
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
|
+
|
|
14
|
+
# Credits
|
|
15
|
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig).
|
|
@@ -0,0 +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
|
+
*/
|
|
47
|
+
declare module "assert/strict" {
|
|
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
|
+
}
|
|
106
|
+
export = strict;
|
|
107
|
+
}
|
|
108
|
+
declare module "node:assert/strict" {
|
|
109
|
+
import strict = require("assert/strict");
|
|
110
|
+
export = strict;
|
|
111
|
+
}
|
|
@@ -1,20 +1,166 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `node:assert` module provides a set of assertion functions for verifying
|
|
3
3
|
* invariants.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
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
|
+
* If set to `true`, skips prototype and constructor
|
|
49
|
+
* comparison in deep equality checks.
|
|
50
|
+
* @since v24.9.0
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
skipPrototype?: boolean | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface Assert extends Pick<typeof assert, AssertMethodNames> {
|
|
56
|
+
readonly [kOptions]: AssertOptions & { strict: false };
|
|
57
|
+
}
|
|
58
|
+
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
|
|
59
|
+
readonly [kOptions]: AssertOptions & { strict: true };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The `Assert` class allows creating independent assertion instances with custom options.
|
|
63
|
+
* @since v24.6.0
|
|
64
|
+
*/
|
|
65
|
+
var Assert: {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
|
|
68
|
+
*
|
|
69
|
+
* ```js
|
|
70
|
+
* const { Assert } = require('node:assert');
|
|
71
|
+
* const assertInstance = new Assert({ diff: 'full' });
|
|
72
|
+
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
|
73
|
+
* // Shows a full diff in the error message.
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* **Important**: When destructuring assertion methods from an `Assert` instance,
|
|
77
|
+
* the methods lose their connection to the instance's configuration options (such
|
|
78
|
+
* as `diff`, `strict`, and `skipPrototype` settings).
|
|
79
|
+
* The destructured methods will fall back to default behavior instead.
|
|
80
|
+
*
|
|
81
|
+
* ```js
|
|
82
|
+
* const myAssert = new Assert({ diff: 'full' });
|
|
83
|
+
*
|
|
84
|
+
* // This works as expected - uses 'full' diff
|
|
85
|
+
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
86
|
+
*
|
|
87
|
+
* // This loses the 'full' diff setting - falls back to default 'simple' diff
|
|
88
|
+
* const { strictEqual } = myAssert;
|
|
89
|
+
* strictEqual({ a: 1 }, { b: { c: 1 } });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* The `skipPrototype` option affects all deep equality methods:
|
|
93
|
+
*
|
|
94
|
+
* ```js
|
|
95
|
+
* class Foo {
|
|
96
|
+
* constructor(a) {
|
|
97
|
+
* this.a = a;
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* class Bar {
|
|
102
|
+
* constructor(a) {
|
|
103
|
+
* this.a = a;
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
107
|
+
* const foo = new Foo(1);
|
|
108
|
+
* const bar = new Bar(1);
|
|
109
|
+
*
|
|
110
|
+
* // Default behavior - fails due to different constructors
|
|
111
|
+
* const assert1 = new Assert();
|
|
112
|
+
* assert1.deepStrictEqual(foo, bar); // AssertionError
|
|
113
|
+
*
|
|
114
|
+
* // Skip prototype comparison - passes if properties are equal
|
|
115
|
+
* const assert2 = new Assert({ skipPrototype: true });
|
|
116
|
+
* assert2.deepStrictEqual(foo, bar); // OK
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
|
|
120
|
+
* (diff: 'simple', non-strict mode).
|
|
121
|
+
* To maintain custom options when using destructured methods, avoid
|
|
122
|
+
* destructuring and call methods directly on the instance.
|
|
123
|
+
* @since v24.6.0
|
|
124
|
+
*/
|
|
125
|
+
new(
|
|
126
|
+
options?: AssertOptions & { strict?: true | undefined },
|
|
127
|
+
): AssertStrict;
|
|
128
|
+
new(
|
|
129
|
+
options: AssertOptions,
|
|
130
|
+
): Assert;
|
|
131
|
+
};
|
|
132
|
+
interface AssertionErrorOptions {
|
|
133
|
+
/**
|
|
134
|
+
* If provided, the error message is set to this value.
|
|
135
|
+
*/
|
|
136
|
+
message?: string | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* The `actual` property on the error instance.
|
|
139
|
+
*/
|
|
140
|
+
actual?: unknown;
|
|
141
|
+
/**
|
|
142
|
+
* The `expected` property on the error instance.
|
|
143
|
+
*/
|
|
144
|
+
expected?: unknown;
|
|
145
|
+
/**
|
|
146
|
+
* The `operator` property on the error instance.
|
|
147
|
+
*/
|
|
148
|
+
operator?: string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* If provided, the generated stack trace omits frames before this function.
|
|
151
|
+
*/
|
|
152
|
+
stackStartFn?: Function | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* If set to `'full'`, shows the full diff in assertion errors.
|
|
155
|
+
* @default 'simple'
|
|
156
|
+
*/
|
|
157
|
+
diff?: "simple" | "full" | undefined;
|
|
158
|
+
}
|
|
14
159
|
/**
|
|
15
160
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
|
16
161
|
*/
|
|
17
162
|
class AssertionError extends Error {
|
|
163
|
+
constructor(options: AssertionErrorOptions);
|
|
18
164
|
/**
|
|
19
165
|
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
20
166
|
*/
|
|
@@ -23,10 +169,6 @@ declare module "assert" {
|
|
|
23
169
|
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
24
170
|
*/
|
|
25
171
|
expected: unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Set to the passed in operator value.
|
|
28
|
-
*/
|
|
29
|
-
operator: string;
|
|
30
172
|
/**
|
|
31
173
|
* Indicates if the message was auto-generated (`true`) or not.
|
|
32
174
|
*/
|
|
@@ -35,19 +177,10 @@ declare module "assert" {
|
|
|
35
177
|
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
|
36
178
|
*/
|
|
37
179
|
code: "ERR_ASSERTION";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
});
|
|
180
|
+
/**
|
|
181
|
+
* Set to the passed in operator value.
|
|
182
|
+
*/
|
|
183
|
+
operator: string;
|
|
51
184
|
}
|
|
52
185
|
/**
|
|
53
186
|
* This feature is deprecated and will be removed in a future version.
|
|
@@ -79,7 +212,9 @@ declare module "assert" {
|
|
|
79
212
|
* @return A function that wraps `fn`.
|
|
80
213
|
*/
|
|
81
214
|
calls(exact?: number): () => void;
|
|
82
|
-
calls
|
|
215
|
+
calls(fn: undefined, exact?: number): () => void;
|
|
216
|
+
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
|
|
217
|
+
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
|
|
83
218
|
/**
|
|
84
219
|
* Example:
|
|
85
220
|
*
|
|
@@ -796,7 +931,7 @@ declare module "assert" {
|
|
|
796
931
|
* check that the promise is rejected.
|
|
797
932
|
*
|
|
798
933
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
|
799
|
-
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
934
|
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value)
|
|
800
935
|
* error. In both cases the error handler is skipped.
|
|
801
936
|
*
|
|
802
937
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
|
@@ -866,7 +1001,7 @@ declare module "assert" {
|
|
|
866
1001
|
*
|
|
867
1002
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
|
868
1003
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
|
869
|
-
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
|
1004
|
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) error. In both cases
|
|
870
1005
|
* the error handler is skipped.
|
|
871
1006
|
*
|
|
872
1007
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
|
@@ -929,7 +1064,7 @@ declare module "assert" {
|
|
|
929
1064
|
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
|
930
1065
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
931
1066
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
932
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
1067
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
933
1068
|
* @since v13.6.0, v12.16.0
|
|
934
1069
|
*/
|
|
935
1070
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -952,7 +1087,7 @@ declare module "assert" {
|
|
|
952
1087
|
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
|
953
1088
|
* to the value of the `message` parameter. If the `message` parameter is
|
|
954
1089
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
|
955
|
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
|
1090
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
|
956
1091
|
* @since v13.6.0, v12.16.0
|
|
957
1092
|
*/
|
|
958
1093
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -968,83 +1103,9 @@ declare module "assert" {
|
|
|
968
1103
|
* @since v22.13.0
|
|
969
1104
|
*/
|
|
970
1105
|
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
*
|
|
975
|
-
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
|
976
|
-
* messages for objects display the objects, often truncated.
|
|
977
|
-
*
|
|
978
|
-
* To use strict assertion mode:
|
|
979
|
-
*
|
|
980
|
-
* ```js
|
|
981
|
-
* import { strict as assert } from 'node:assert';
|
|
982
|
-
* import assert from 'node:assert/strict';
|
|
983
|
-
* ```
|
|
984
|
-
*
|
|
985
|
-
* Example error diff:
|
|
986
|
-
*
|
|
987
|
-
* ```js
|
|
988
|
-
* import { strict as assert } from 'node:assert';
|
|
989
|
-
*
|
|
990
|
-
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
|
991
|
-
* // AssertionError: Expected inputs to be strictly deep-equal:
|
|
992
|
-
* // + actual - expected ... Lines skipped
|
|
993
|
-
* //
|
|
994
|
-
* // [
|
|
995
|
-
* // [
|
|
996
|
-
* // ...
|
|
997
|
-
* // 2,
|
|
998
|
-
* // + 3
|
|
999
|
-
* // - '3'
|
|
1000
|
-
* // ],
|
|
1001
|
-
* // ...
|
|
1002
|
-
* // 5
|
|
1003
|
-
* // ]
|
|
1004
|
-
* ```
|
|
1005
|
-
*
|
|
1006
|
-
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
|
1007
|
-
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
|
1008
|
-
* `getColorDepth()` documentation.
|
|
1009
|
-
*
|
|
1010
|
-
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
|
1011
|
-
*/
|
|
1012
|
-
namespace strict {
|
|
1013
|
-
type AssertionError = assert.AssertionError;
|
|
1014
|
-
type AssertPredicate = assert.AssertPredicate;
|
|
1015
|
-
type CallTrackerCall = assert.CallTrackerCall;
|
|
1016
|
-
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
|
1017
|
-
}
|
|
1018
|
-
const strict:
|
|
1019
|
-
& Omit<
|
|
1020
|
-
typeof assert,
|
|
1021
|
-
| "equal"
|
|
1022
|
-
| "notEqual"
|
|
1023
|
-
| "deepEqual"
|
|
1024
|
-
| "notDeepEqual"
|
|
1025
|
-
| "ok"
|
|
1026
|
-
| "strictEqual"
|
|
1027
|
-
| "deepStrictEqual"
|
|
1028
|
-
| "ifError"
|
|
1029
|
-
| "strict"
|
|
1030
|
-
| "AssertionError"
|
|
1031
|
-
>
|
|
1032
|
-
& {
|
|
1033
|
-
(value: unknown, message?: string | Error): asserts value;
|
|
1034
|
-
equal: typeof strictEqual;
|
|
1035
|
-
notEqual: typeof notStrictEqual;
|
|
1036
|
-
deepEqual: typeof deepStrictEqual;
|
|
1037
|
-
notDeepEqual: typeof notDeepStrictEqual;
|
|
1038
|
-
// Mapped types and assertion functions are incompatible?
|
|
1039
|
-
// TS2775: Assertions require every name in the call target
|
|
1040
|
-
// to be declared with an explicit type annotation.
|
|
1041
|
-
ok: typeof ok;
|
|
1042
|
-
strictEqual: typeof strictEqual;
|
|
1043
|
-
deepStrictEqual: typeof deepStrictEqual;
|
|
1044
|
-
ifError: typeof ifError;
|
|
1045
|
-
strict: typeof strict;
|
|
1046
|
-
AssertionError: typeof AssertionError;
|
|
1047
|
-
};
|
|
1106
|
+
}
|
|
1107
|
+
namespace assert {
|
|
1108
|
+
export { strict };
|
|
1048
1109
|
}
|
|
1049
1110
|
export = assert;
|
|
1050
1111
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* We strongly discourage the use of the `async_hooks` API.
|
|
3
3
|
* Other APIs that can cover most of its use cases include:
|
|
4
4
|
*
|
|
5
|
-
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-
|
|
6
|
-
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-
|
|
5
|
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v24.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
|
6
|
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
|
7
7
|
*
|
|
8
8
|
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
|
9
9
|
* It can be accessed using:
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* import async_hooks from 'node:async_hooks';
|
|
13
13
|
* ```
|
|
14
14
|
* @experimental
|
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/async_hooks.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module "async_hooks" {
|
|
18
18
|
/**
|
|
@@ -44,7 +44,7 @@ declare module "async_hooks" {
|
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
46
46
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
|
47
|
-
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
|
47
|
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
|
48
48
|
* @since v8.1.0
|
|
49
49
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
|
50
50
|
*/
|
|
@@ -117,7 +117,7 @@ declare module "async_hooks" {
|
|
|
117
117
|
* ```
|
|
118
118
|
*
|
|
119
119
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
|
120
|
-
* the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
|
120
|
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
|
121
121
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
|
122
122
|
*/
|
|
123
123
|
function triggerAsyncId(): number;
|
|
@@ -320,6 +320,16 @@ declare module "async_hooks" {
|
|
|
320
320
|
*/
|
|
321
321
|
triggerAsyncId(): number;
|
|
322
322
|
}
|
|
323
|
+
interface AsyncLocalStorageOptions {
|
|
324
|
+
/**
|
|
325
|
+
* The default value to be used when no store is provided.
|
|
326
|
+
*/
|
|
327
|
+
defaultValue?: any;
|
|
328
|
+
/**
|
|
329
|
+
* A name for the `AsyncLocalStorage` value.
|
|
330
|
+
*/
|
|
331
|
+
name?: string | undefined;
|
|
332
|
+
}
|
|
323
333
|
/**
|
|
324
334
|
* This class creates stores that stay coherent through asynchronous operations.
|
|
325
335
|
*
|
|
@@ -358,8 +368,8 @@ declare module "async_hooks" {
|
|
|
358
368
|
* http.get('http://localhost:8080');
|
|
359
369
|
* // Prints:
|
|
360
370
|
* // 0: start
|
|
361
|
-
* // 1: start
|
|
362
371
|
* // 0: finish
|
|
372
|
+
* // 1: start
|
|
363
373
|
* // 1: finish
|
|
364
374
|
* ```
|
|
365
375
|
*
|
|
@@ -369,6 +379,11 @@ declare module "async_hooks" {
|
|
|
369
379
|
* @since v13.10.0, v12.17.0
|
|
370
380
|
*/
|
|
371
381
|
class AsyncLocalStorage<T> {
|
|
382
|
+
/**
|
|
383
|
+
* Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
|
|
384
|
+
* `run()` call or after an `enterWith()` call.
|
|
385
|
+
*/
|
|
386
|
+
constructor(options?: AsyncLocalStorageOptions);
|
|
372
387
|
/**
|
|
373
388
|
* Binds the given function to the current execution context.
|
|
374
389
|
* @since v19.8.0
|
|
@@ -430,6 +445,11 @@ declare module "async_hooks" {
|
|
|
430
445
|
* @since v13.10.0, v12.17.0
|
|
431
446
|
*/
|
|
432
447
|
getStore(): T | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* The name of the `AsyncLocalStorage` instance if provided.
|
|
450
|
+
* @since v24.0.0
|
|
451
|
+
*/
|
|
452
|
+
readonly name: string;
|
|
433
453
|
/**
|
|
434
454
|
* Runs a function synchronously within a context and returns its
|
|
435
455
|
* return value. The store is not accessible outside of the callback function.
|
|
@@ -451,7 +451,16 @@ declare module "buffer" {
|
|
|
451
451
|
*/
|
|
452
452
|
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
|
|
453
453
|
}
|
|
454
|
+
// TODO: remove globals in future version
|
|
455
|
+
/**
|
|
456
|
+
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
|
457
|
+
* TypeScript versions earlier than 5.7.
|
|
458
|
+
*/
|
|
454
459
|
type NonSharedBuffer = Buffer<ArrayBuffer>;
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
|
462
|
+
* TypeScript versions earlier than 5.7.
|
|
463
|
+
*/
|
|
455
464
|
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
|
456
465
|
}
|
|
457
466
|
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
|
@@ -46,7 +46,7 @@ type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : impo
|
|
|
46
46
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
|
47
47
|
* const buf7 = Buffer.from('tést', 'latin1');
|
|
48
48
|
* ```
|
|
49
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
49
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js)
|
|
50
50
|
*/
|
|
51
51
|
declare module "buffer" {
|
|
52
52
|
import { BinaryLike } from "node:crypto";
|
|
@@ -59,7 +59,7 @@ declare module "buffer" {
|
|
|
59
59
|
* @since v19.4.0, v18.14.0
|
|
60
60
|
* @param input The input to validate.
|
|
61
61
|
*/
|
|
62
|
-
export function isUtf8(input:
|
|
62
|
+
export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean;
|
|
63
63
|
/**
|
|
64
64
|
* This function returns `true` if `input` contains only valid ASCII-encoded data,
|
|
65
65
|
* including the case in which `input` is empty.
|
|
@@ -68,7 +68,7 @@ declare module "buffer" {
|
|
|
68
68
|
* @since v19.6.0, v18.15.0
|
|
69
69
|
* @param input The input to validate.
|
|
70
70
|
*/
|
|
71
|
-
export function isAscii(input:
|
|
71
|
+
export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean;
|
|
72
72
|
export let INSPECT_MAX_BYTES: number;
|
|
73
73
|
export const kMaxLength: number;
|
|
74
74
|
export const kStringMaxLength: number;
|
|
@@ -113,12 +113,15 @@ declare module "buffer" {
|
|
|
113
113
|
* @param fromEnc The current encoding.
|
|
114
114
|
* @param toEnc To target encoding.
|
|
115
115
|
*/
|
|
116
|
-
export function transcode(
|
|
116
|
+
export function transcode(
|
|
117
|
+
source: Uint8Array,
|
|
118
|
+
fromEnc: TranscodeEncoding,
|
|
119
|
+
toEnc: TranscodeEncoding,
|
|
120
|
+
): NonSharedBuffer;
|
|
117
121
|
/**
|
|
118
122
|
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
|
119
123
|
* a prior call to `URL.createObjectURL()`.
|
|
120
124
|
* @since v16.7.0
|
|
121
|
-
* @experimental
|
|
122
125
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
123
126
|
*/
|
|
124
127
|
export function resolveObjectURL(id: string): Blob | undefined;
|
|
@@ -140,7 +143,7 @@ declare module "buffer" {
|
|
|
140
143
|
type?: string | undefined;
|
|
141
144
|
}
|
|
142
145
|
/**
|
|
143
|
-
* A
|
|
146
|
+
* A `Blob` encapsulates immutable, raw data that can be safely shared across
|
|
144
147
|
* multiple worker threads.
|
|
145
148
|
* @since v15.7.0, v14.18.0
|
|
146
149
|
*/
|
|
@@ -331,7 +334,7 @@ declare module "buffer" {
|
|
|
331
334
|
* @return The number of bytes contained within `string`.
|
|
332
335
|
*/
|
|
333
336
|
byteLength(
|
|
334
|
-
string: string |
|
|
337
|
+
string: string | NodeJS.ArrayBufferView | ArrayBufferLike,
|
|
335
338
|
encoding?: BufferEncoding,
|
|
336
339
|
): number;
|
|
337
340
|
/**
|
|
@@ -1702,6 +1705,8 @@ declare module "buffer" {
|
|
|
1702
1705
|
* @return A reference to `buf`.
|
|
1703
1706
|
*/
|
|
1704
1707
|
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
|
1708
|
+
fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
|
|
1709
|
+
fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
|
|
1705
1710
|
/**
|
|
1706
1711
|
* If `value` is:
|
|
1707
1712
|
*
|
|
@@ -1771,6 +1776,7 @@ declare module "buffer" {
|
|
|
1771
1776
|
* @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
|
1772
1777
|
*/
|
|
1773
1778
|
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
1779
|
+
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1774
1780
|
/**
|
|
1775
1781
|
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
|
|
1776
1782
|
* rather than the first occurrence.
|
|
@@ -1839,6 +1845,7 @@ declare module "buffer" {
|
|
|
1839
1845
|
* @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
|
1840
1846
|
*/
|
|
1841
1847
|
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
1848
|
+
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1842
1849
|
/**
|
|
1843
1850
|
* Equivalent to `buf.indexOf() !== -1`.
|
|
1844
1851
|
*
|
|
@@ -1869,6 +1876,7 @@ declare module "buffer" {
|
|
|
1869
1876
|
* @return `true` if `value` was found in `buf`, `false` otherwise.
|
|
1870
1877
|
*/
|
|
1871
1878
|
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
|
1879
|
+
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
|
1872
1880
|
}
|
|
1873
1881
|
var Buffer: BufferConstructor;
|
|
1874
1882
|
/**
|