Skip to content

Commit 054e118

Browse files
🤖 Merge PR DefinitelyTyped#72580 [node] Update typings to v22.15.0 by @Renegade334
Co-authored-by: Jacob Smith <[email protected]>
1 parent fde9eaa commit 054e118

25 files changed

+757
-225
lines changed

types/node/assert.d.ts

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -957,55 +957,14 @@ declare module "assert" {
957957
*/
958958
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
959959
/**
960-
* `assert.partialDeepStrictEqual()` Asserts the equivalence between the `actual` and `expected` parameters through a
961-
* deep comparison, ensuring that all properties in the `expected` parameter are
962-
* present in the `actual` parameter with equivalent values, not allowing type coercion.
963-
* The main difference with `assert.deepStrictEqual()` is that `assert.partialDeepStrictEqual()` does not require
964-
* all properties in the `actual` parameter to be present in the `expected` parameter.
965-
* This method should always pass the same test cases as `assert.deepStrictEqual()`, behaving as a super set of it.
966-
*
967-
* ```js
968-
* import assert from 'node:assert';
969-
*
970-
* assert.partialDeepStrictEqual({ a: 1, b: 2 }, { a: 1, b: 2 });
971-
* // OK
972-
*
973-
* assert.partialDeepStrictEqual({ a: { b: { c: 1 } } }, { a: { b: { c: 1 } } });
974-
* // OK
975-
*
976-
* assert.partialDeepStrictEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 });
977-
* // OK
978-
*
979-
* assert.partialDeepStrictEqual(new Set(['value1', 'value2']), new Set(['value1', 'value2']));
980-
* // OK
981-
*
982-
* assert.partialDeepStrictEqual(new Map([['key1', 'value1']]), new Map([['key1', 'value1']]));
983-
* // OK
984-
*
985-
* assert.partialDeepStrictEqual(new Uint8Array([1, 2, 3]), new Uint8Array([1, 2, 3]));
986-
* // OK
987-
*
988-
* assert.partialDeepStrictEqual(/abc/, /abc/);
989-
* // OK
990-
*
991-
* assert.partialDeepStrictEqual([{ a: 5 }, { b: 5 }], [{ a: 5 }]);
992-
* // OK
993-
*
994-
* assert.partialDeepStrictEqual(new Set([{ a: 1 }, { b: 1 }]), new Set([{ a: 1 }]));
995-
* // OK
996-
*
997-
* assert.partialDeepStrictEqual(new Date(0), new Date(0));
998-
* // OK
999-
*
1000-
* assert.partialDeepStrictEqual({ a: 1 }, { a: 1, b: 2 });
1001-
* // AssertionError
1002-
*
1003-
* assert.partialDeepStrictEqual({ a: 1, b: '2' }, { a: 1, b: 2 });
1004-
* // AssertionError
960+
* Tests for partial deep equality between the `actual` and `expected` parameters.
961+
* "Deep" equality means that the enumerable "own" properties of child objects
962+
* are recursively evaluated also by the following rules. "Partial" equality means
963+
* that only properties that exist on the `expected` parameter are going to be
964+
* compared.
1005965
*
1006-
* assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } });
1007-
* // AssertionError
1008-
* ```
966+
* This method always passes the same test cases as `assert.deepStrictEqual()`,
967+
* behaving as a super set of it.
1009968
* @since v22.13.0
1010969
*/
1011970
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;

types/node/async_hooks.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ declare module "async_hooks" {
372372
/**
373373
* Binds the given function to the current execution context.
374374
* @since v19.8.0
375-
* @experimental
376375
* @param fn The function to bind to the current execution context.
377376
* @return A new function that calls `fn` within the captured execution context.
378377
*/
@@ -403,7 +402,6 @@ declare module "async_hooks" {
403402
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
404403
* ```
405404
* @since v19.8.0
406-
* @experimental
407405
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
408406
*/
409407
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;

types/node/crypto.d.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,9 +4221,13 @@ declare module "crypto" {
42214221
* - `'PBKDF2'`
42224222
* @since v15.0.0
42234223
*/
4224-
deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
42254224
deriveBits(
4226-
algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params,
4225+
algorithm: EcdhKeyDeriveParams,
4226+
baseKey: CryptoKey,
4227+
length?: number | null,
4228+
): Promise<ArrayBuffer>;
4229+
deriveBits(
4230+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
42274231
baseKey: CryptoKey,
42284232
length: number,
42294233
): Promise<ArrayBuffer>;
@@ -4245,14 +4249,9 @@ declare module "crypto" {
42454249
* @since v15.0.0
42464250
*/
42474251
deriveKey(
4248-
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
4252+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
42494253
baseKey: CryptoKey,
4250-
derivedKeyAlgorithm:
4251-
| AlgorithmIdentifier
4252-
| AesDerivedKeyParams
4253-
| HmacImportParams
4254-
| HkdfParams
4255-
| Pbkdf2Params,
4254+
derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
42564255
extractable: boolean,
42574256
keyUsages: readonly KeyUsage[],
42584257
): Promise<CryptoKey>;

types/node/fs/promises.d.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@ declare module "fs/promises" {
8787
highWaterMark?: number | undefined;
8888
flush?: boolean | undefined;
8989
}
90-
interface ReadableWebStreamOptions {
91-
/**
92-
* Whether to open a normal or a `'bytes'` stream.
93-
* @since v20.0.0
94-
*/
95-
type?: "bytes" | undefined;
96-
}
9790
// TODO: Add `EventEmitter` close
9891
interface FileHandle {
9992
/**
@@ -244,7 +237,8 @@ declare module "fs/promises" {
244237
): Promise<FileReadResult<T>>;
245238
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
246239
/**
247-
* Returns a `ReadableStream` that may be used to read the files data.
240+
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
241+
* contents.
248242
*
249243
* An error will be thrown if this method is called more than once or is called
250244
* after the `FileHandle` is closed or closing.
@@ -267,7 +261,7 @@ declare module "fs/promises" {
267261
* @since v17.0.0
268262
* @experimental
269263
*/
270-
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
264+
readableWebStream(): ReadableStream;
271265
/**
272266
* Asynchronously reads the entire contents of a file.
273267
*

types/node/http2.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ declare module "http2" {
12521252
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
12531253
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
12541254
> extends SessionOptions {
1255+
streamResetBurst?: number | undefined;
1256+
streamResetRate?: number | undefined;
12551257
Http1IncomingMessage?: Http1Request | undefined;
12561258
Http1ServerResponse?: Http1Response | undefined;
12571259
Http2ServerRequest?: Http2Request | undefined;
@@ -1269,10 +1271,7 @@ declare module "http2" {
12691271
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
12701272
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
12711273
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
1272-
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
1273-
streamResetBurst?: number | undefined;
1274-
streamResetRate?: number | undefined;
1275-
}
1274+
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
12761275
export interface SecureServerOptions<
12771276
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
12781277
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,

types/node/inspector.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,38 @@ declare module 'inspector' {
17201720
* Monotonically increasing time in seconds since an arbitrary point in the past.
17211721
*/
17221722
type MonotonicTime = number;
1723+
/**
1724+
* Information about the request initiator.
1725+
*/
1726+
interface Initiator {
1727+
/**
1728+
* Type of this initiator.
1729+
*/
1730+
type: string;
1731+
/**
1732+
* Initiator JavaScript stack trace, set for Script only.
1733+
* Requires the Debugger domain to be enabled.
1734+
*/
1735+
stack?: Runtime.StackTrace | undefined;
1736+
/**
1737+
* Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.
1738+
*/
1739+
url?: string | undefined;
1740+
/**
1741+
* Initiator line number, set for Parser type or for Script type (when script is importing
1742+
* module) (0-based).
1743+
*/
1744+
lineNumber?: number | undefined;
1745+
/**
1746+
* Initiator column number, set for Parser type or for Script type (when script is importing
1747+
* module) (0-based).
1748+
*/
1749+
columnNumber?: number | undefined;
1750+
/**
1751+
* Set if another request triggered this request (e.g. preflight).
1752+
*/
1753+
requestId?: RequestId | undefined;
1754+
}
17231755
/**
17241756
* HTTP request data.
17251757
*/
@@ -1751,6 +1783,10 @@ declare module 'inspector' {
17511783
* Request data.
17521784
*/
17531785
request: Request;
1786+
/**
1787+
* Request initiator.
1788+
*/
1789+
initiator: Initiator;
17541790
/**
17551791
* Timestamp.
17561792
*/

types/node/module.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,31 @@ declare module "module" {
220220
options?: RegisterOptions<Data>,
221221
): void;
222222
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
223+
interface RegisterHooksOptions {
224+
/**
225+
* See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload).
226+
* @default undefined
227+
*/
228+
load?: LoadHook | undefined;
229+
/**
230+
* See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve).
231+
* @default undefined
232+
*/
233+
resolve?: ResolveHook | undefined;
234+
}
235+
interface ModuleHooks {
236+
/**
237+
* Deregister the hook instance.
238+
*/
239+
deregister(): void;
240+
}
241+
/**
242+
* Register [hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks)
243+
* that customize Node.js module resolution and loading behavior.
244+
* @since v22.15.0
245+
* @experimental
246+
*/
247+
function registerHooks(options: RegisterHooksOptions): ModuleHooks;
223248
interface StripTypeScriptTypesOptions {
224249
/**
225250
* Possible values are:

types/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/node",
4-
"version": "22.14.9999",
4+
"version": "22.15.9999",
55
"nonNpm": "conflict",
66
"nonNpmDescription": "Node.js",
77
"projects": [

types/node/process.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,28 @@ declare module "process" {
19381938
* @param maybeRefable An object that may be "unref'd".
19391939
*/
19401940
unref(maybeRefable: any): void;
1941+
/**
1942+
* Replaces the current process with a new process.
1943+
*
1944+
* This is achieved by using the `execve` POSIX function and therefore no memory or other
1945+
* resources from the current process are preserved, except for the standard input,
1946+
* standard output and standard error file descriptor.
1947+
*
1948+
* All other resources are discarded by the system when the processes are swapped, without triggering
1949+
* any exit or close events and without running any cleanup handler.
1950+
*
1951+
* This function will never return, unless an error occurred.
1952+
*
1953+
* This function is not available on Windows or IBM i.
1954+
* @since v22.15.0
1955+
* @experimental
1956+
* @param file The name or path of the executable file to run.
1957+
* @param args List of string arguments. No argument can contain a null-byte (`\u0000`).
1958+
* @param env Environment key-value pairs.
1959+
* No key or value can contain a null-byte (`\u0000`).
1960+
* **Default:** `process.env`.
1961+
*/
1962+
execve?(file: string, args?: readonly string[], env?: ProcessEnv): never;
19411963
/* EventEmitter */
19421964
addListener(event: "beforeExit", listener: BeforeExitListener): this;
19431965
addListener(event: "disconnect", listener: DisconnectListener): this;

types/node/readline.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare module "readline" {
5151
* and is read from, the `input` stream.
5252
* @since v0.1.104
5353
*/
54-
export class Interface extends EventEmitter {
54+
export class Interface extends EventEmitter implements Disposable {
5555
readonly terminal: boolean;
5656
/**
5757
* The current input data being processed by node.
@@ -208,6 +208,11 @@ declare module "readline" {
208208
* @since v0.1.98
209209
*/
210210
close(): void;
211+
/**
212+
* Alias for `rl.close()`.
213+
* @since v22.15.0
214+
*/
215+
[Symbol.dispose](): void;
211216
/**
212217
* The `rl.write()` method will write either `data` or a key sequence identified
213218
* by `key` to the `output`. The `key` argument is supported only if `output` is

0 commit comments

Comments
 (0)