Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 7 additions & 48 deletions types/node/assert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,55 +957,14 @@ declare module "assert" {
*/
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
/**
* `assert.partialDeepStrictEqual()` Asserts the equivalence between the `actual` and `expected` parameters through a
* deep comparison, ensuring that all properties in the `expected` parameter are
* present in the `actual` parameter with equivalent values, not allowing type coercion.
* The main difference with `assert.deepStrictEqual()` is that `assert.partialDeepStrictEqual()` does not require
* all properties in the `actual` parameter to be present in the `expected` parameter.
* This method should always pass the same test cases as `assert.deepStrictEqual()`, behaving as a super set of it.
*
* ```js
* import assert from 'node:assert';
*
* assert.partialDeepStrictEqual({ a: 1, b: 2 }, { a: 1, b: 2 });
* // OK
*
* assert.partialDeepStrictEqual({ a: { b: { c: 1 } } }, { a: { b: { c: 1 } } });
* // OK
*
* assert.partialDeepStrictEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 });
* // OK
*
* assert.partialDeepStrictEqual(new Set(['value1', 'value2']), new Set(['value1', 'value2']));
* // OK
*
* assert.partialDeepStrictEqual(new Map([['key1', 'value1']]), new Map([['key1', 'value1']]));
* // OK
*
* assert.partialDeepStrictEqual(new Uint8Array([1, 2, 3]), new Uint8Array([1, 2, 3]));
* // OK
*
* assert.partialDeepStrictEqual(/abc/, /abc/);
* // OK
*
* assert.partialDeepStrictEqual([{ a: 5 }, { b: 5 }], [{ a: 5 }]);
* // OK
*
* assert.partialDeepStrictEqual(new Set([{ a: 1 }, { b: 1 }]), new Set([{ a: 1 }]));
* // OK
*
* assert.partialDeepStrictEqual(new Date(0), new Date(0));
* // OK
*
* assert.partialDeepStrictEqual({ a: 1 }, { a: 1, b: 2 });
* // AssertionError
*
* assert.partialDeepStrictEqual({ a: 1, b: '2' }, { a: 1, b: 2 });
* // AssertionError
* Tests for partial deep equality between the `actual` and `expected` parameters.
* "Deep" equality means that the enumerable "own" properties of child objects
* are recursively evaluated also by the following rules. "Partial" equality means
* that only properties that exist on the `expected` parameter are going to be
* compared.
*
* assert.partialDeepStrictEqual({ a: { b: 2 } }, { a: { b: '2' } });
* // AssertionError
* ```
* This method always passes the same test cases as `assert.deepStrictEqual()`,
* behaving as a super set of it.
* @since v22.13.0
*/
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
Expand Down
2 changes: 0 additions & 2 deletions types/node/async_hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ declare module "async_hooks" {
/**
* Binds the given function to the current execution context.
* @since v19.8.0
* @experimental
* @param fn The function to bind to the current execution context.
* @return A new function that calls `fn` within the captured execution context.
*/
Expand Down Expand Up @@ -403,7 +402,6 @@ declare module "async_hooks" {
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
* ```
* @since v19.8.0
* @experimental
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
*/
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
Expand Down
17 changes: 8 additions & 9 deletions types/node/crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4221,9 +4221,13 @@ declare module "crypto" {
* - `'PBKDF2'`
* @since v15.0.0
*/
deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
deriveBits(
algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params,
algorithm: EcdhKeyDeriveParams,
baseKey: CryptoKey,
length?: number | null,
): Promise<ArrayBuffer>;
deriveBits(
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
baseKey: CryptoKey,
length: number,
): Promise<ArrayBuffer>;
Expand All @@ -4245,14 +4249,9 @@ declare module "crypto" {
* @since v15.0.0
*/
deriveKey(
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
baseKey: CryptoKey,
derivedKeyAlgorithm:
| AlgorithmIdentifier
| AesDerivedKeyParams
| HmacImportParams
| HkdfParams
| Pbkdf2Params,
derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
extractable: boolean,
keyUsages: readonly KeyUsage[],
): Promise<CryptoKey>;
Expand Down
12 changes: 3 additions & 9 deletions types/node/fs/promises.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ declare module "fs/promises" {
highWaterMark?: number | undefined;
flush?: boolean | undefined;
}
interface ReadableWebStreamOptions {
/**
* Whether to open a normal or a `'bytes'` stream.
* @since v20.0.0
*/
type?: "bytes" | undefined;
}
// TODO: Add `EventEmitter` close
interface FileHandle {
/**
Expand Down Expand Up @@ -244,7 +237,8 @@ declare module "fs/promises" {
): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
/**
* Returns a `ReadableStream` that may be used to read the files data.
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
* contents.
*
* An error will be thrown if this method is called more than once or is called
* after the `FileHandle` is closed or closing.
Expand All @@ -267,7 +261,7 @@ declare module "fs/promises" {
* @since v17.0.0
* @experimental
*/
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
readableWebStream(): ReadableStream;
/**
* Asynchronously reads the entire contents of a file.
*
Expand Down
7 changes: 3 additions & 4 deletions types/node/http2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,8 @@ declare module "http2" {
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
> extends SessionOptions {
streamResetBurst?: number | undefined;
streamResetRate?: number | undefined;
Http1IncomingMessage?: Http1Request | undefined;
Http1ServerResponse?: Http1Response | undefined;
Http2ServerRequest?: Http2Request | undefined;
Expand All @@ -1269,10 +1271,7 @@ declare module "http2" {
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
streamResetBurst?: number | undefined;
streamResetRate?: number | undefined;
}
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
export interface SecureServerOptions<
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
Expand Down
36 changes: 36 additions & 0 deletions types/node/inspector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,38 @@ declare module 'inspector' {
* Monotonically increasing time in seconds since an arbitrary point in the past.
*/
type MonotonicTime = number;
/**
* Information about the request initiator.
*/
interface Initiator {
/**
* Type of this initiator.
*/
type: string;
/**
* Initiator JavaScript stack trace, set for Script only.
* Requires the Debugger domain to be enabled.
*/
stack?: Runtime.StackTrace | undefined;
/**
* Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.
*/
url?: string | undefined;
/**
* Initiator line number, set for Parser type or for Script type (when script is importing
* module) (0-based).
*/
lineNumber?: number | undefined;
/**
* Initiator column number, set for Parser type or for Script type (when script is importing
* module) (0-based).
*/
columnNumber?: number | undefined;
/**
* Set if another request triggered this request (e.g. preflight).
*/
requestId?: RequestId | undefined;
}
/**
* HTTP request data.
*/
Expand Down Expand Up @@ -1751,6 +1783,10 @@ declare module 'inspector' {
* Request data.
*/
request: Request;
/**
* Request initiator.
*/
initiator: Initiator;
/**
* Timestamp.
*/
Expand Down
25 changes: 25 additions & 0 deletions types/node/module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,31 @@ declare module "module" {
options?: RegisterOptions<Data>,
): void;
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
interface RegisterHooksOptions {
/**
* See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload).
* @default undefined
*/
load?: LoadHook | undefined;
/**
* See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve).
* @default undefined
*/
resolve?: ResolveHook | undefined;
}
interface ModuleHooks {
/**
* Deregister the hook instance.
*/
deregister(): void;
}
/**
* Register [hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks)
* that customize Node.js module resolution and loading behavior.
* @since v22.15.0
* @experimental
*/
function registerHooks(options: RegisterHooksOptions): ModuleHooks;
interface StripTypeScriptTypesOptions {
/**
* Possible values are:
Expand Down
2 changes: 1 addition & 1 deletion types/node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/node",
"version": "22.14.9999",
"version": "22.15.9999",
"nonNpm": "conflict",
"nonNpmDescription": "Node.js",
"projects": [
Expand Down
22 changes: 22 additions & 0 deletions types/node/process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,28 @@ declare module "process" {
* @param maybeRefable An object that may be "unref'd".
*/
unref(maybeRefable: any): void;
/**
* Replaces the current process with a new process.
*
* This is achieved by using the `execve` POSIX function and therefore no memory or other
* resources from the current process are preserved, except for the standard input,
* standard output and standard error file descriptor.
*
* All other resources are discarded by the system when the processes are swapped, without triggering
* any exit or close events and without running any cleanup handler.
*
* This function will never return, unless an error occurred.
*
* This function is not available on Windows or IBM i.
* @since v22.15.0
* @experimental
* @param file The name or path of the executable file to run.
* @param args List of string arguments. No argument can contain a null-byte (`\u0000`).
* @param env Environment key-value pairs.
* No key or value can contain a null-byte (`\u0000`).
* **Default:** `process.env`.
*/
execve?(file: string, args?: readonly string[], env?: ProcessEnv): never;
/* EventEmitter */
addListener(event: "beforeExit", listener: BeforeExitListener): this;
addListener(event: "disconnect", listener: DisconnectListener): this;
Expand Down
7 changes: 6 additions & 1 deletion types/node/readline.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ declare module "readline" {
* and is read from, the `input` stream.
* @since v0.1.104
*/
export class Interface extends EventEmitter {
export class Interface extends EventEmitter implements Disposable {
readonly terminal: boolean;
/**
* The current input data being processed by node.
Expand Down Expand Up @@ -208,6 +208,11 @@ declare module "readline" {
* @since v0.1.98
*/
close(): void;
/**
* Alias for `rl.close()`.
* @since v22.15.0
*/
[Symbol.dispose](): void;
/**
* The `rl.write()` method will write either `data` or a key sequence identified
* by `key` to the `output`. The `key` argument is supported only if `output` is
Expand Down
Loading