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
1 change: 0 additions & 1 deletion types/node/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
/v18/
/v20/
/v22/
2 changes: 1 addition & 1 deletion types/node/assert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ declare module "assert" {
* @since v24.6.0
*/
new(
options?: AssertOptions & { strict?: true },
options?: AssertOptions & { strict?: true | undefined },
): AssertStrict;
new(
options: AssertOptions,
Expand Down
24 changes: 15 additions & 9 deletions types/node/child_process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ declare module "child_process" {
import { Abortable, EventEmitter } from "node:events";
import * as dgram from "node:dgram";
import * as net from "node:net";
import { Pipe, Readable, Stream, Writable } from "node:stream";
import { Readable, Stream, Writable } from "node:stream";
import { URL } from "node:url";
type Serializable = string | object | number | boolean | bigint;
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
Expand Down Expand Up @@ -139,7 +139,7 @@ declare module "child_process" {
* no IPC channel exists, this property is `undefined`.
* @since v7.1.0
*/
readonly channel?: Pipe | null | undefined;
readonly channel?: Control | null;
/**
* A sparse array of pipes to the child process, corresponding with positions in
* the `stdio` option passed to {@link spawn} that have been set
Expand Down Expand Up @@ -612,6 +612,10 @@ declare module "child_process" {
Readable | Writable | null | undefined, // extra, no modification
];
}
interface Control extends EventEmitter {
ref(): void;
unref(): void;
}
interface MessageOptions {
keepOpen?: boolean | undefined;
}
Expand Down Expand Up @@ -894,11 +898,12 @@ declare module "child_process" {
interface ExecOptionsWithBufferEncoding extends ExecOptions {
encoding: "buffer" | null; // specify `null`.
}
// TODO: Just Plain Wrong™ (see also nodejs/node#57392)
interface ExecException extends Error {
cmd?: string | undefined;
killed?: boolean | undefined;
code?: number | undefined;
signal?: NodeJS.Signals | undefined;
cmd?: string;
killed?: boolean;
code?: number;
signal?: NodeJS.Signals;
stdout?: string;
stderr?: string;
}
Expand Down Expand Up @@ -1056,10 +1061,11 @@ declare module "child_process" {
}
/** @deprecated Use `ExecFileOptions` instead. */
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
// TODO: execFile exceptions can take many forms... this accurately describes none of them
type ExecFileException =
& Omit<ExecException, "code">
& Omit<NodeJS.ErrnoException, "code">
& { code?: string | number | undefined | null };
& { code?: string | number | null };
/**
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
* executable `file` is spawned directly as a new process making it slightly more
Expand Down Expand Up @@ -1320,7 +1326,7 @@ declare module "child_process" {
stderr: T;
status: number | null;
signal: NodeJS.Signals | null;
error?: Error | undefined;
error?: Error;
}
/**
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
Expand Down Expand Up @@ -1409,7 +1415,7 @@ declare module "child_process" {
encoding: BufferEncoding;
}
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
encoding?: "buffer" | null; // specify `null`.
encoding?: "buffer" | null | undefined; // specify `null`.
}
/**
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
Expand Down
7 changes: 3 additions & 4 deletions types/node/cluster.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ declare module "cluster" {
* ```
* @since v0.7.0
*/
readonly worker?: Worker | undefined;
readonly worker?: Worker;
/**
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
*
Expand All @@ -497,7 +497,7 @@ declare module "cluster" {
* ```
* @since v0.7.0
*/
readonly workers?: NodeJS.Dict<Worker> | undefined;
readonly workers?: NodeJS.Dict<Worker>;
readonly SCHED_NONE: number;
readonly SCHED_RR: number;
/**
Expand Down Expand Up @@ -550,10 +550,9 @@ declare module "cluster" {
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
prependListener(event: "fork", listener: (worker: Worker) => void): this;
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
// the handle is a net.Socket or net.Server object, or undefined.
prependListener(
event: "message",
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this;
prependListener(event: "online", listener: (worker: Worker) => void): this;
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
Expand Down
70 changes: 35 additions & 35 deletions types/node/crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,50 +510,50 @@ declare module "crypto" {
format: "jwk";
}
interface JsonWebKey {
crv?: string | undefined;
d?: string | undefined;
dp?: string | undefined;
dq?: string | undefined;
e?: string | undefined;
k?: string | undefined;
kty?: string | undefined;
n?: string | undefined;
p?: string | undefined;
q?: string | undefined;
qi?: string | undefined;
x?: string | undefined;
y?: string | undefined;
crv?: string;
d?: string;
dp?: string;
dq?: string;
e?: string;
k?: string;
kty?: string;
n?: string;
p?: string;
q?: string;
qi?: string;
x?: string;
y?: string;
[key: string]: unknown;
}
interface AsymmetricKeyDetails {
/**
* Key size in bits (RSA, DSA).
*/
modulusLength?: number | undefined;
modulusLength?: number;
/**
* Public exponent (RSA).
*/
publicExponent?: bigint | undefined;
publicExponent?: bigint;
/**
* Name of the message digest (RSA-PSS).
*/
hashAlgorithm?: string | undefined;
hashAlgorithm?: string;
/**
* Name of the message digest used by MGF1 (RSA-PSS).
*/
mgf1HashAlgorithm?: string | undefined;
mgf1HashAlgorithm?: string;
/**
* Minimal salt length in bytes (RSA-PSS).
*/
saltLength?: number | undefined;
saltLength?: number;
/**
* Size of q in bits (DSA).
*/
divisorLength?: number | undefined;
divisorLength?: number;
/**
* Name of the curve (EC).
*/
namedCurve?: string | undefined;
namedCurve?: string;
}
/**
* Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
Expand Down Expand Up @@ -598,7 +598,7 @@ declare module "crypto" {
* keys.
* @since v11.6.0
*/
asymmetricKeyType?: KeyType | undefined;
asymmetricKeyType?: KeyType;
/**
* This property exists only on asymmetric keys. Depending on the type of the key,
* this object contains information about the key. None of the information obtained
Expand All @@ -612,7 +612,7 @@ declare module "crypto" {
* Other key details might be exposed via this API using additional attributes.
* @since v15.7.0
*/
asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
asymmetricKeyDetails?: AsymmetricKeyDetails;
/**
* For symmetric keys, the following encoding options can be used:
*
Expand Down Expand Up @@ -651,7 +651,7 @@ declare module "crypto" {
* property is `undefined` for asymmetric keys.
* @since v11.6.0
*/
symmetricKeySize?: number | undefined;
symmetricKeySize?: number;
/**
* Converts a `KeyObject` instance to a `CryptoKey`.
* @since 22.10.0
Expand Down Expand Up @@ -2512,15 +2512,15 @@ declare module "crypto" {
/**
* Name of the message digest
*/
hashAlgorithm?: string;
hashAlgorithm?: string | undefined;
/**
* Name of the message digest used by MGF1
*/
mgf1HashAlgorithm?: string;
mgf1HashAlgorithm?: string | undefined;
/**
* Minimal salt length in bytes
*/
saltLength?: string;
saltLength?: string | undefined;
}
interface DSAKeyPairKeyObjectOptions {
/**
Expand Down Expand Up @@ -2563,15 +2563,15 @@ declare module "crypto" {
/**
* Name of the message digest
*/
hashAlgorithm?: string;
hashAlgorithm?: string | undefined;
/**
* Name of the message digest used by MGF1
*/
mgf1HashAlgorithm?: string;
mgf1HashAlgorithm?: string | undefined;
/**
* Minimal salt length in bytes
*/
saltLength?: string;
saltLength?: string | undefined;
publicKeyEncoding: {
type: "spki";
format: PubF;
Expand Down Expand Up @@ -3835,23 +3835,23 @@ declare module "crypto" {
/**
* @default 'always'
*/
subject?: "always" | "default" | "never";
subject?: "always" | "default" | "never" | undefined;
/**
* @default true
*/
wildcards?: boolean;
wildcards?: boolean | undefined;
/**
* @default true
*/
partialWildcards?: boolean;
partialWildcards?: boolean | undefined;
/**
* @default false
*/
multiLabelWildcards?: boolean;
multiLabelWildcards?: boolean | undefined;
/**
* @default false
*/
singleLabelSubdomains?: boolean;
singleLabelSubdomains?: boolean | undefined;
}
/**
* Encapsulates an X509 certificate and provides read-only access to
Expand Down Expand Up @@ -3953,7 +3953,7 @@ declare module "crypto" {
* available.
* @since v15.9.0
*/
readonly issuerCertificate?: X509Certificate | undefined;
readonly issuerCertificate: X509Certificate | undefined;
/**
* The public key `KeyObject` for this certificate.
* @since v15.6.0
Expand Down
2 changes: 1 addition & 1 deletion types/node/dns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ declare module "dns" {
* The number of tries the resolver will try contacting each name server before giving up.
* @default 4
*/
tries?: number;
tries?: number | undefined;
/**
* The max retry timeout, in milliseconds.
* @default 0
Expand Down
2 changes: 1 addition & 1 deletion types/node/events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ declare module "events" {
* directly rather than as a child class.
* @default new.target.name if instantiated as a child class.
*/
name?: string;
name?: string | undefined;
}

/**
Expand Down
22 changes: 11 additions & 11 deletions types/node/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,7 @@ declare module "fs" {
/**
* @default null
*/
position?: number | undefined | null;
position?: number | null | undefined;
}
/**
* Write `buffer` to the file specified by `fd`.
Expand Down Expand Up @@ -4463,7 +4463,7 @@ declare module "fs" {
/**
* @default false
*/
recursive?: boolean;
recursive?: boolean | undefined;
}
/**
* Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
Expand Down Expand Up @@ -4516,54 +4516,54 @@ declare module "fs" {
* Dereference symlinks
* @default false
*/
dereference?: boolean;
dereference?: boolean | undefined;
/**
* When `force` is `false`, and the destination
* exists, throw an error.
* @default false
*/
errorOnExist?: boolean;
errorOnExist?: boolean | undefined;
/**
* Overwrite existing file or directory. _The copy
* operation will ignore errors if you set this to false and the destination
* exists. Use the `errorOnExist` option to change this behavior.
* @default true
*/
force?: boolean;
force?: boolean | undefined;
/**
* Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
*/
mode?: number;
mode?: number | undefined;
/**
* When `true` timestamps from `src` will
* be preserved.
* @default false
*/
preserveTimestamps?: boolean;
preserveTimestamps?: boolean | undefined;
/**
* Copy directories recursively.
* @default false
*/
recursive?: boolean;
recursive?: boolean | undefined;
/**
* When true, path resolution for symlinks will be skipped
* @default false
*/
verbatimSymlinks?: boolean;
verbatimSymlinks?: boolean | undefined;
}
export interface CopyOptions extends CopyOptionsBase {
/**
* Function to filter copied files/directories. Return
* `true` to copy the item, `false` to ignore it.
*/
filter?(source: string, destination: string): boolean | Promise<boolean>;
filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
}
export interface CopySyncOptions extends CopyOptionsBase {
/**
* Function to filter copied files/directories. Return
* `true` to copy the item, `false` to ignore it.
*/
filter?(source: string, destination: string): boolean;
filter?: ((source: string, destination: string) => boolean) | undefined;
}
/**
* Asynchronously copies the entire directory structure from `src` to `dest`,
Expand Down
Loading