From 92ee9c22b5740595bc0475008e8ac5952954aa76 Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Fri, 19 Apr 2019 12:48:09 -0700 Subject: [PATCH] fix: node callbacks (#34770) * fix: node callbacks * fix line length * fix related libs * fix oibackoff --- types/iferr/index.d.ts | 2 +- types/mapnik/mapnik-tests.ts | 2 +- types/node/dgram.d.ts | 2 +- types/node/dns.d.ts | 70 +++---- types/node/fs.d.ts | 155 ++++++++------- types/node/node-tests.ts | 22 +-- types/node/stream.d.ts | 14 +- types/node/test/stream.ts | 4 +- types/node/test/util.ts | 10 +- types/node/util.d.ts | 22 +-- types/node/v10/dgram.d.ts | 2 +- types/node/v10/dns.d.ts | 70 +++---- types/node/v10/fs.d.ts | 155 ++++++++------- types/node/v10/stream.d.ts | 14 +- types/node/v10/util.d.ts | 26 +-- types/node/v6/index.d.ts | 186 ++++++++--------- types/node/v8/index.d.ts | 230 +++++++++++----------- types/oibackoff/index.d.ts | 160 +++++++-------- types/oibackoff/oibackoff-tests.ts | 2 +- types/readdir-enhanced/index.d.ts | 2 +- types/rollup-plugin-sourcemaps/index.d.ts | 2 +- 21 files changed, 593 insertions(+), 559 deletions(-) diff --git a/types/iferr/index.d.ts b/types/iferr/index.d.ts index 0b40866559..a1bcd66a48 100644 --- a/types/iferr/index.d.ts +++ b/types/iferr/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: segayuu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type nodeCallback = (err: Error | undefined, ...a: T[]) => any; +type nodeCallback = (err: Error | null, ...a: T[]) => any; // Delegates to `succ` on sucecss or to `fail` on error // ex: Thing.load(123, iferr(cb, thing => ...)) diff --git a/types/mapnik/mapnik-tests.ts b/types/mapnik/mapnik-tests.ts index 23e726f111..11be9a4d27 100644 --- a/types/mapnik/mapnik-tests.ts +++ b/types/mapnik/mapnik-tests.ts @@ -14,7 +14,7 @@ map.load('./test/stylesheet.xml', function xx(err: Error, map: mapnik.Map) { if (err) throw err; im.encode('png', function xxxx(err: Error, buffer: Buffer) { if (err) throw err; - fs.writeFile('map.png', buffer, function xxxxx(err: Error) { + fs.writeFile('map.png', buffer, function xxxxx(err: Error | null) { if (err) throw err; console.log('saved map image to map.png'); }); diff --git a/types/node/dgram.d.ts b/types/node/dgram.d.ts index 4e0ec6fda7..d995f2b594 100644 --- a/types/node/dgram.d.ts +++ b/types/node/dgram.d.ts @@ -27,7 +27,7 @@ declare module "dgram" { ipv6Only?: boolean; recvBufferSize?: number; sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void) => void; + lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; } function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; diff --git a/types/node/dns.d.ts b/types/node/dns.d.ts index a77216f797..f932c136b1 100644 --- a/types/node/dns.d.ts +++ b/types/node/dns.d.ts @@ -23,11 +23,11 @@ declare module "dns" { family: number; } - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lookup { @@ -36,7 +36,7 @@ declare module "dns" { function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>; } - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void; + function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; namespace lookupService { function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; @@ -144,22 +144,22 @@ declare module "dns" { AnySrvRecord | AnyTxtRecord; - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; function resolve( hostname: string, rrtype: string, - callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, ): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. @@ -174,9 +174,9 @@ declare module "dns" { function __promisify__(hostname: string, rrtype: string): Promise; } - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace resolve4 { @@ -185,9 +185,9 @@ declare module "dns" { function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace resolve6 { @@ -196,52 +196,52 @@ declare module "dns" { function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolveCname { function __promisify__(hostname: string): Promise; } - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; namespace resolveMx { function __promisify__(hostname: string): Promise; } - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; namespace resolveNaptr { function __promisify__(hostname: string): Promise; } - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolveNs { function __promisify__(hostname: string): Promise; } - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolvePtr { function __promisify__(hostname: string): Promise; } - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; namespace resolveSoa { function __promisify__(hostname: string): Promise; } - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; namespace resolveSrv { function __promisify__(hostname: string): Promise; } - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; namespace resolveTxt { function __promisify__(hostname: string): Promise; } - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; namespace resolveAny { function __promisify__(hostname: string): Promise; } - function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; + function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; function setServers(servers: string[]): void; function getServers(): string[]; diff --git a/types/node/fs.d.ts b/types/node/fs.d.ts index 105ce92036..88eaef6b59 100644 --- a/types/node/fs.d.ts +++ b/types/node/fs.d.ts @@ -146,7 +146,7 @@ declare module "fs" { * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace rename { @@ -174,14 +174,14 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param len If not specified, defaults to `0`. */ - function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous truncate(2) - Truncate a file to a specified length. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace truncate { @@ -205,13 +205,13 @@ declare module "fs" { * @param fd A file descriptor. * @param len If not specified, defaults to `0`. */ - function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous ftruncate(2) - Truncate a file to a specified length. * @param fd A file descriptor. */ - function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace ftruncate { @@ -234,7 +234,7 @@ declare module "fs" { * Asynchronous chown(2) - Change ownership of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace chown { @@ -255,7 +255,7 @@ declare module "fs" { * Asynchronous fchown(2) - Change ownership of a file. * @param fd A file descriptor. */ - function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fchown { @@ -276,7 +276,7 @@ declare module "fs" { * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lchown { @@ -298,7 +298,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace chmod { @@ -322,7 +322,7 @@ declare module "fs" { * @param fd A file descriptor. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fchmod { @@ -346,7 +346,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lchmod { @@ -369,7 +369,7 @@ declare module "fs" { * Asynchronous stat(2) - Get file status. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace stat { @@ -390,7 +390,7 @@ declare module "fs" { * Asynchronous fstat(2) - Get file status. * @param fd A file descriptor. */ - function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fstat { @@ -411,7 +411,7 @@ declare module "fs" { * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lstat { @@ -433,7 +433,7 @@ declare module "fs" { * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace link { @@ -459,14 +459,14 @@ declare module "fs" { * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. */ - function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous symlink(2) - Create a new symbolic link to an existing file. * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. */ - function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace symlink { @@ -496,27 +496,31 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + function readlink( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, linkString: string) => void + ): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, linkString: Buffer) => void): void; + function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string | Buffer) => void): void; + function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readlink { @@ -568,27 +572,31 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function realpath( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void + ): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; + function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; + function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace realpath { @@ -613,10 +621,14 @@ declare module "fs" { */ function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - function native(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; - function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; - function native(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function native( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void + ): void; + function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; } /** @@ -650,7 +662,7 @@ declare module "fs" { * Asynchronous unlink(2) - delete a name and possibly the file it refers to. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace unlink { @@ -671,7 +683,7 @@ declare module "fs" { * Asynchronous rmdir(2) - delete a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace rmdir { @@ -707,13 +719,13 @@ declare module "fs" { * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace mkdir { @@ -739,27 +751,27 @@ declare module "fs" { * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException, folder: Buffer) => void): void; + function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string | Buffer) => void): void; + function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. */ - function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace mkdtemp { @@ -814,7 +826,7 @@ declare module "fs" { function readdir( path: PathLike, options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException, files: string[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, ): void; /** @@ -822,7 +834,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -832,21 +844,21 @@ declare module "fs" { function readdir( path: PathLike, options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null, - callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, ): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. */ - function readdir(path: PathLike, options: { withFileTypes: true }, callback: (err: NodeJS.ErrnoException, files: Dirent[]) => void): void; + function readdir(path: PathLike, options: { withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readdir { @@ -911,7 +923,7 @@ declare module "fs" { * Asynchronous close(2) - close a file descriptor. * @param fd A file descriptor. */ - function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function close(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace close { @@ -933,13 +945,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. */ - function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; /** * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace open { @@ -964,7 +976,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace utimes { @@ -991,7 +1003,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace futimes { @@ -1016,7 +1028,7 @@ declare module "fs" { * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. * @param fd A file descriptor. */ - function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fsync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fsync { @@ -1046,7 +1058,7 @@ declare module "fs" { offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, ): void; /** @@ -1060,7 +1072,7 @@ declare module "fs" { buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, ): void; /** @@ -1068,13 +1080,18 @@ declare module "fs" { * @param fd A file descriptor. * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. */ - function write(fd: number, buffer: TBuffer, offset: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; /** * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. */ - function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. @@ -1088,7 +1105,7 @@ declare module "fs" { string: any, position: number | undefined | null, encoding: string | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, ): void; /** @@ -1097,14 +1114,14 @@ declare module "fs" { * @param string A string to write. If something other than a string is supplied it will be coerced to a string. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. */ - function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. * @param string A string to write. If something other than a string is supplied it will be coerced to a string. */ - function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace write { @@ -1165,7 +1182,7 @@ declare module "fs" { offset: number, length: number, position: number | null, - callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, ): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. @@ -1197,7 +1214,7 @@ declare module "fs" { * @param options An object that may contain an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -1207,7 +1224,7 @@ declare module "fs" { * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -1220,7 +1237,7 @@ declare module "fs" { function readFile( path: PathLike | number, options: { encoding?: string | null; flag?: string; } | string | undefined | null, - callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, ): void; /** @@ -1228,7 +1245,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * If a file descriptor is provided, the underlying file will _not_ be closed automatically. */ - function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readFile { @@ -1305,7 +1322,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'w'` is used. */ - function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; + function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously writes data to a file, replacing the file if it already exists. @@ -1314,7 +1331,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace writeFile { @@ -1359,7 +1376,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'a'` is used. */ - function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; + function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously append data to a file, creating the file if it does not exist. @@ -1368,7 +1385,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace appendFile { @@ -1653,14 +1670,14 @@ declare module "fs" { * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException) => void): void; + function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously tests a user's permissions for the file specified by path. * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function access(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace access { @@ -1713,7 +1730,7 @@ declare module "fs" { * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. * @param fd A file descriptor. */ - function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fdatasync { @@ -1739,7 +1756,7 @@ declare module "fs" { * @param src A path to the source file. * @param dest A path to the destination file. */ - function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. * No arguments other than a possible exception are given to the callback function. @@ -1750,7 +1767,7 @@ declare module "fs" { * @param dest A path to the destination file. * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. */ - function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException) => void): void; + function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace copyFile { diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 0ffd45f0e6..06ba08771f 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -82,7 +82,7 @@ import Module = require("module"); } { - fs.read(1, new DataView(new ArrayBuffer(1)), 0, 1, 0, (err: NodeJS.ErrnoException, bytesRead: number, buffer: DataView) => {}); + fs.read(1, new DataView(new ArrayBuffer(1)), 0, 1, 0, (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: DataView) => {}); } { @@ -118,7 +118,7 @@ import Module = require("module"); fs.readdirSync('path', { encoding: enc }); fs.readdirSync('path', { }); - fs.readdir('path', { withFileTypes: true }, (err: NodeJS.ErrnoException, files: fs.Dirent[]) => {}); + fs.readdir('path', { withFileTypes: true }, (err: NodeJS.ErrnoException | null, files: fs.Dirent[]) => {}); } { fs.mkdtemp('/tmp/foo-', (err, folder) => { @@ -755,22 +755,22 @@ import Module = require("module"); { dns.lookup("nodejs.org", (err, address, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", 4, (err, address, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", 6, (err, address, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", {}, (err, address, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: string = address; const _family: number = family; }); @@ -782,17 +782,17 @@ import Module = require("module"); all: false }, (err, address, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: string = address; const _family: number = family; } ); dns.lookup("nodejs.org", { all: true }, (err, addresses) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: dns.LookupAddress[] = addresses; }); dns.lookup("nodejs.org", { all: true, verbatim: true }, (err, addresses) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _address: dns.LookupAddress[] = addresses; }); @@ -800,13 +800,13 @@ import Module = require("module"); return Math.random() > 0.5 ? true : false; } dns.lookup("nodejs.org", { all: trueOrFalse() }, (err, addresses, family) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _addresses: string | dns.LookupAddress[] = addresses; const _family: number | undefined = family; }); dns.lookupService("127.0.0.1", 0, (err, hostname, service) => { - const _err: NodeJS.ErrnoException = err; + const _err: NodeJS.ErrnoException | null = err; const _hostname: string = hostname; const _service: string = service; }); diff --git a/types/node/stream.d.ts b/types/node/stream.d.ts index d94d26022f..84ce0ea9b5 100644 --- a/types/node/stream.d.ts +++ b/types/node/stream.d.ts @@ -246,19 +246,19 @@ declare module "stream" { class PassThrough extends Transform { } - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void): () => void; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; namespace finished { function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise; } - function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T; - function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException) => void): T; + function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; + function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; function pipeline( stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: T, - callback?: (err: NodeJS.ErrnoException) => void, + callback?: (err: NodeJS.ErrnoException | null) => void, ): T; function pipeline( stream1: NodeJS.ReadableStream, @@ -266,13 +266,13 @@ declare module "stream" { stream3: NodeJS.ReadWriteStream, stream4: NodeJS.ReadWriteStream, stream5: T, - callback?: (err: NodeJS.ErrnoException) => void, + callback?: (err: NodeJS.ErrnoException | null) => void, ): T; - function pipeline(streams: Array, callback?: (err: NodeJS.ErrnoException) => void): NodeJS.WritableStream; + function pipeline(streams: Array, callback?: (err: NodeJS.ErrnoException | null) => void): NodeJS.WritableStream; function pipeline( stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array void)>, + ...streams: Array void)>, ): NodeJS.WritableStream; namespace pipeline { function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise; diff --git a/types/node/test/stream.ts b/types/node/test/stream.ts index 6fd656e61c..892f5a0fca 100644 --- a/types/node/test/stream.ts +++ b/types/node/test/stream.ts @@ -159,10 +159,10 @@ function simplified_stream_ctor_test() { } function streamPipelineFinished() { - const cancel = finished(process.stdin, (err?: Error) => {}); + const cancel = finished(process.stdin, (err?: Error | null) => {}); cancel(); - pipeline(process.stdin, process.stdout, (err?: Error) => {}); + pipeline(process.stdin, process.stdout, (err?: Error | null) => {}); } async function asyncStreamPipelineFinished() { diff --git a/types/node/test/util.ts b/types/node/test/util.ts index 716348a3fa..a18466624b 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -102,13 +102,13 @@ import { readFile } from 'fs'; const cfnT1TResult = util.callbackify(callbackifyTest.fnT1TResult); const cfnT1TResultE = util.callbackify(callbackifyTest.fnT1TResultE); - cfn((err: NodeJS.ErrnoException, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); + cfn((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); cfnE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); - cfnT1('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); + cfnT1('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); cfnT1E('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); - cfnTResult((err: NodeJS.ErrnoException, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); + cfnTResult((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); cfnTResultE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); - cfnT1TResult('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); + cfnT1TResult('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); cfnT1TResultE('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); } } @@ -121,7 +121,7 @@ import { readFile } from 'fs'; const arg0NoResult: () => Promise = util.promisify((cb: (err: Error) => void): void => { }); const arg1: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error, result: number) => void): void => { }); const arg1NoResult: (arg: string) => Promise = util.promisify((arg: string, cb: (err: Error) => void): void => { }); - const cbOptionalError: () => Promise = util.promisify((cb: (err?: Error | null) => void): void => { cb(); }); // tslint:disable-line void-return + const cbOptionalError: () => Promise = util.promisify((cb: (err?: Error) => void): void => { cb(); }); // tslint:disable-line void-return assert(typeof util.promisify.custom === 'symbol'); // util.deprecate const foo = () => {}; diff --git a/types/node/util.d.ts b/types/node/util.d.ts index a7fc3de21a..98949cee74 100644 --- a/types/node/util.d.ts +++ b/types/node/util.d.ts @@ -71,44 +71,44 @@ declare module "util" { function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function promisify(fn: CustomPromisify): TCustom; function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; + function promisify(fn: (callback: (err?: Error) => void) => void): () => Promise; function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; + function promisify(fn: (arg1: T1, callback: (err?: Error) => void) => void): (arg1: T1) => Promise; function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2) => Promise; function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; function promisify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; function promisify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void, + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; function promisify(fn: Function): Function; diff --git a/types/node/v10/dgram.d.ts b/types/node/v10/dgram.d.ts index 48049b47b8..4b9fe012cc 100644 --- a/types/node/v10/dgram.d.ts +++ b/types/node/v10/dgram.d.ts @@ -22,7 +22,7 @@ declare module "dgram" { reuseAddr?: boolean; recvBufferSize?: number; sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void) => void; + lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; } function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; diff --git a/types/node/v10/dns.d.ts b/types/node/v10/dns.d.ts index a77216f797..f932c136b1 100644 --- a/types/node/v10/dns.d.ts +++ b/types/node/v10/dns.d.ts @@ -23,11 +23,11 @@ declare module "dns" { family: number; } - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lookup { @@ -36,7 +36,7 @@ declare module "dns" { function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>; } - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void; + function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; namespace lookupService { function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; @@ -144,22 +144,22 @@ declare module "dns" { AnySrvRecord | AnyTxtRecord; - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; function resolve( hostname: string, rrtype: string, - callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, ): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. @@ -174,9 +174,9 @@ declare module "dns" { function __promisify__(hostname: string, rrtype: string): Promise; } - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace resolve4 { @@ -185,9 +185,9 @@ declare module "dns" { function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace resolve6 { @@ -196,52 +196,52 @@ declare module "dns" { function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolveCname { function __promisify__(hostname: string): Promise; } - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; namespace resolveMx { function __promisify__(hostname: string): Promise; } - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; namespace resolveNaptr { function __promisify__(hostname: string): Promise; } - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolveNs { function __promisify__(hostname: string): Promise; } - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; namespace resolvePtr { function __promisify__(hostname: string): Promise; } - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; namespace resolveSoa { function __promisify__(hostname: string): Promise; } - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; namespace resolveSrv { function __promisify__(hostname: string): Promise; } - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; namespace resolveTxt { function __promisify__(hostname: string): Promise; } - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; namespace resolveAny { function __promisify__(hostname: string): Promise; } - function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; + function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; function setServers(servers: string[]): void; function getServers(): string[]; diff --git a/types/node/v10/fs.d.ts b/types/node/v10/fs.d.ts index e3718475e5..f00e4f2640 100644 --- a/types/node/v10/fs.d.ts +++ b/types/node/v10/fs.d.ts @@ -146,7 +146,7 @@ declare module "fs" { * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace rename { @@ -174,14 +174,14 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param len If not specified, defaults to `0`. */ - function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous truncate(2) - Truncate a file to a specified length. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace truncate { @@ -205,13 +205,13 @@ declare module "fs" { * @param fd A file descriptor. * @param len If not specified, defaults to `0`. */ - function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous ftruncate(2) - Truncate a file to a specified length. * @param fd A file descriptor. */ - function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace ftruncate { @@ -234,7 +234,7 @@ declare module "fs" { * Asynchronous chown(2) - Change ownership of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace chown { @@ -255,7 +255,7 @@ declare module "fs" { * Asynchronous fchown(2) - Change ownership of a file. * @param fd A file descriptor. */ - function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fchown { @@ -276,7 +276,7 @@ declare module "fs" { * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lchown { @@ -298,7 +298,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace chmod { @@ -322,7 +322,7 @@ declare module "fs" { * @param fd A file descriptor. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fchmod { @@ -346,7 +346,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lchmod { @@ -369,7 +369,7 @@ declare module "fs" { * Asynchronous stat(2) - Get file status. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace stat { @@ -390,7 +390,7 @@ declare module "fs" { * Asynchronous fstat(2) - Get file status. * @param fd A file descriptor. */ - function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fstat { @@ -411,7 +411,7 @@ declare module "fs" { * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace lstat { @@ -433,7 +433,7 @@ declare module "fs" { * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace link { @@ -459,14 +459,14 @@ declare module "fs" { * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. */ - function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous symlink(2) - Create a new symbolic link to an existing file. * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. */ - function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace symlink { @@ -496,27 +496,31 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + function readlink( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, linkString: string) => void + ): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, linkString: Buffer) => void): void; + function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string | Buffer) => void): void; + function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readlink { @@ -568,27 +572,31 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function realpath( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void + ): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; + function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; + function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace realpath { @@ -613,10 +621,14 @@ declare module "fs" { */ function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - function native(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; - function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; - function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; - function native(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + function native( + path: PathLike, + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void + ): void; + function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; } /** @@ -650,7 +662,7 @@ declare module "fs" { * Asynchronous unlink(2) - delete a name and possibly the file it refers to. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace unlink { @@ -671,7 +683,7 @@ declare module "fs" { * Asynchronous rmdir(2) - delete a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace rmdir { @@ -707,13 +719,13 @@ declare module "fs" { * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace mkdir { @@ -739,27 +751,27 @@ declare module "fs" { * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException, folder: Buffer) => void): void; + function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string | Buffer) => void): void; + function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. */ - function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace mkdtemp { @@ -814,7 +826,7 @@ declare module "fs" { function readdir( path: PathLike, options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException, files: string[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, ): void; /** @@ -822,7 +834,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -832,21 +844,21 @@ declare module "fs" { function readdir( path: PathLike, options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null, - callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void, + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, ): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. */ - function readdir(path: PathLike, options: { withFileTypes: true }, callback: (err: NodeJS.ErrnoException, files: Dirent[]) => void): void; + function readdir(path: PathLike, options: { withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readdir { @@ -911,7 +923,7 @@ declare module "fs" { * Asynchronous close(2) - close a file descriptor. * @param fd A file descriptor. */ - function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function close(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace close { @@ -933,13 +945,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. */ - function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; /** * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace open { @@ -964,7 +976,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace utimes { @@ -991,7 +1003,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace futimes { @@ -1016,7 +1028,7 @@ declare module "fs" { * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. * @param fd A file descriptor. */ - function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fsync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fsync { @@ -1046,7 +1058,7 @@ declare module "fs" { offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, ): void; /** @@ -1060,7 +1072,7 @@ declare module "fs" { buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, ): void; /** @@ -1068,13 +1080,18 @@ declare module "fs" { * @param fd A file descriptor. * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. */ - function write(fd: number, buffer: TBuffer, offset: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; /** * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. */ - function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. @@ -1088,7 +1105,7 @@ declare module "fs" { string: any, position: number | undefined | null, encoding: string | undefined | null, - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, ): void; /** @@ -1097,14 +1114,14 @@ declare module "fs" { * @param string A string to write. If something other than a string is supplied it will be coerced to a string. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. */ - function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. * @param string A string to write. If something other than a string is supplied it will be coerced to a string. */ - function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace write { @@ -1165,7 +1182,7 @@ declare module "fs" { offset: number, length: number, position: number | null, - callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void, + callback?: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, ): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. @@ -1197,7 +1214,7 @@ declare module "fs" { * @param options An object that may contain an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -1207,7 +1224,7 @@ declare module "fs" { * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -1220,7 +1237,7 @@ declare module "fs" { function readFile( path: PathLike | number, options: { encoding?: string | null; flag?: string; } | string | undefined | null, - callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, ): void; /** @@ -1228,7 +1245,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * If a file descriptor is provided, the underlying file will _not_ be closed automatically. */ - function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace readFile { @@ -1305,7 +1322,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'w'` is used. */ - function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; + function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously writes data to a file, replacing the file if it already exists. @@ -1314,7 +1331,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace writeFile { @@ -1359,7 +1376,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'a'` is used. */ - function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; + function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously append data to a file, creating the file if it does not exist. @@ -1368,7 +1385,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace appendFile { @@ -1653,14 +1670,14 @@ declare module "fs" { * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException) => void): void; + function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously tests a user's permissions for the file specified by path. * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function access(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace access { @@ -1713,7 +1730,7 @@ declare module "fs" { * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. * @param fd A file descriptor. */ - function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace fdatasync { @@ -1739,7 +1756,7 @@ declare module "fs" { * @param src A path to the source file. * @param dest A path to the destination file. */ - function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. * No arguments other than a possible exception are given to the callback function. @@ -1750,7 +1767,7 @@ declare module "fs" { * @param dest A path to the destination file. * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. */ - function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException) => void): void; + function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. namespace copyFile { diff --git a/types/node/v10/stream.d.ts b/types/node/v10/stream.d.ts index a4428728db..902cd855f4 100644 --- a/types/node/v10/stream.d.ts +++ b/types/node/v10/stream.d.ts @@ -242,19 +242,19 @@ declare module "stream" { class PassThrough extends Transform { } - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void): () => void; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; namespace finished { function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise; } - function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T; - function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException) => void): T; + function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; + function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; function pipeline( stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: T, - callback?: (err: NodeJS.ErrnoException) => void, + callback?: (err: NodeJS.ErrnoException | null) => void, ): T; function pipeline( stream1: NodeJS.ReadableStream, @@ -262,13 +262,13 @@ declare module "stream" { stream3: NodeJS.ReadWriteStream, stream4: NodeJS.ReadWriteStream, stream5: T, - callback?: (err: NodeJS.ErrnoException) => void, + callback?: (err: NodeJS.ErrnoException | null) => void, ): T; - function pipeline(streams: Array, callback?: (err: NodeJS.ErrnoException) => void): NodeJS.WritableStream; + function pipeline(streams: Array, callback?: (err: NodeJS.ErrnoException | null) => void): NodeJS.WritableStream; function pipeline( stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array void)>, + ...streams: Array void)>, ): NodeJS.WritableStream; namespace pipeline { function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise; diff --git a/types/node/v10/util.d.ts b/types/node/v10/util.d.ts index 05b6ab3df1..872cfe241b 100644 --- a/types/node/v10/util.d.ts +++ b/types/node/v10/util.d.ts @@ -63,48 +63,48 @@ declare module "util" { } function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; function callbackify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; function promisify(fn: CustomPromisify): TCustom; function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; + function promisify(fn: (callback: (err?: Error) => void) => void): () => Promise; function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; + function promisify(fn: (arg1: T1, callback: (err?: Error) => void) => void): (arg1: T1) => Promise; function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2) => Promise; function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; function promisify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; function promisify( fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void, + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error) => void) => void, ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; function promisify(fn: Function): Function; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index f4fa74291c..c8355583eb 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2065,13 +2065,13 @@ declare module "dns" { family: number; } - export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; - export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void; + export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; export interface MxRecord { priority: number; @@ -2104,31 +2104,31 @@ declare module "dns" { name: string; } - export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; - export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; - export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; - export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; - export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; - export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; - export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; - export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; - export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; //Error codes @@ -2572,56 +2572,56 @@ declare module "fs" { * Asynchronous rename. * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Synchronous rename */ export function renameSync(oldPath: string, newPath: string): void; - export function truncate(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function truncate(path: string | Buffer, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function truncate(path: string | Buffer, len: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function truncateSync(path: string | Buffer, len?: number): void; - export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function ftruncateSync(fd: number, len?: number): void; - export function chown(path: string | Buffer, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chown(path: string | Buffer, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function chownSync(path: string | Buffer, uid: number, gid: number): void; - export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function fchownSync(fd: number, uid: number, gid: number): void; - export function lchown(path: string | Buffer, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchown(path: string | Buffer, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function lchownSync(path: string | Buffer, uid: number, gid: number): void; - export function chmod(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function chmod(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function chmod(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function chmodSync(path: string | Buffer, mode: number): void; export function chmodSync(path: string | Buffer, mode: string): void; - export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function fchmodSync(fd: number, mode: number): void; export function fchmodSync(fd: number, mode: string): void; - export function lchmod(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function lchmod(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function lchmod(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function lchmodSync(path: string | Buffer, mode: number): void; export function lchmodSync(path: string | Buffer, mode: string): void; - export function stat(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; - export function lstat(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; - export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function stat(path: string | Buffer, callback?: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; + export function lstat(path: string | Buffer, callback?: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; export function statSync(path: string | Buffer): Stats; export function lstatSync(path: string | Buffer): Stats; export function fstatSync(fd: number): Stats; - export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function linkSync(srcpath: string | Buffer, dstpath: string | Buffer): void; - export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function symlinkSync(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): void; - export function readlink(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlink(path: string | Buffer, callback?: (err: NodeJS.ErrnoException | null, linkString: string) => any): void; export function readlinkSync(path: string | Buffer): string; - export function realpath(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; - export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string | Buffer, callback?: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void; + export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void; export function realpathSync(path: string | Buffer, cache?: { [path: string]: string }): string; /** * Asynchronous unlink - deletes the file specified in {path} * * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function unlink(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function unlink(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Synchronous unlink - deletes the file specified in {path} */ @@ -2631,7 +2631,7 @@ declare module "fs" { * * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function rmdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function rmdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Synchronous rmdir - removes the directory specified in {path} */ @@ -2641,19 +2641,19 @@ declare module "fs" { * * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function mkdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string | Buffer, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function mkdir(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string | Buffer, mode: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * * @param callback No arguments other than a possible exception are given to the completion callback. */ - export function mkdir(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string | Buffer, mode: string, callback?: (err?: NodeJS.ErrnoException | null) => void): void; /** * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * @@ -2671,7 +2671,7 @@ declare module "fs" { * * @param callback The created folder path is passed as a string to the callback's second parameter. */ - export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException, folder: string) => void): void; + export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException | null, folder: string) => void): void; /** * Synchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @@ -2683,26 +2683,26 @@ declare module "fs" { * @param path A path to a file. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: string | Buffer, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdir(path: string | Buffer, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: string | Buffer, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + export function readdir(path: string | Buffer, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: string | Buffer, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; + export function readdir(path: string | Buffer, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. */ - export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; /** * Synchronous readdir(3) - read a directory. * @param path A path to a file. @@ -2723,60 +2723,60 @@ declare module "fs" { * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ export function readdirSync(path: string | Buffer, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; - export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function closeSync(fd: number): void; - export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; - export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; export function openSync(path: string | Buffer, flags: string | number, mode?: number): number; - export function utimes(path: string | Buffer, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string | Buffer, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function utimesSync(path: string | Buffer, atime: number, mtime: number): void; export function utimesSync(path: string | Buffer, atime: Date, mtime: Date): void; - export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function futimesSync(fd: number, atime: number, mtime: number): void; export function futimesSync(fd: number, atime: Date, mtime: Date): void; - export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException | null) => void): void; export function fsyncSync(fd: number): void; - export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; - export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; - export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; - export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; - export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException | null, written: number, buffer: Buffer) => void): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException | null, written: number, buffer: Buffer) => void): void; + export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): number; export function writeSync(fd: number, data: any, position?: number | null, enconding?: string): number; - export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: Buffer) => void): void; export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): number; /** * Asynchronous readFile - Asynchronously reads the entire contents of a file. * * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. */ - export function readFile(filename: string, encoding: null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; - export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; - export function readFile(filename: string, encoding: string | null, callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void): void; + export function readFile(filename: string, encoding: null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; + export function readFile(filename: string, encoding: string | null, callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void): void; /** * Asynchronous readFile - Asynchronously reads the entire contents of a file. * * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. */ - export function readFile(filename: string, options: { encoding: null; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; - export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; - export function readFile(filename: string, options: { encoding: string | null; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void): void; + export function readFile(filename: string, options: { encoding: null; flag?: string; }, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; + export function readFile(filename: string, options: { encoding: string | null; flag?: string; }, callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void): void; /** * Asynchronous readFile - Asynchronously reads the entire contents of a file. * * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. */ - export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; /** * Asynchronous readFile - Asynchronously reads the entire contents of a file. * * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. */ - export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; /** * Synchronous readFile - Synchronously reads the entire contents of a file. */ @@ -2797,17 +2797,17 @@ declare module "fs" { * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; - export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException | null) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException | null) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException | null) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException | null) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException | null) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException | null) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException | null) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException | null) => void): void; export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; @@ -2948,8 +2948,8 @@ declare module "fs" { } /** Tests a user's permissions for the file specified by path. */ - export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; - export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null) => void): void; + export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException | null) => void): void; /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ export function accessSync(path: string | Buffer, mode?: number): void; export function createReadStream(path: string | Buffer, options?: { diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index dd92b36a94..77590f38fe 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -2473,11 +2473,11 @@ declare module "dns" { family: number; } - export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace lookup { @@ -2486,7 +2486,7 @@ declare module "dns" { export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>; } - export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void; + export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; export namespace lookupService { export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; @@ -2591,19 +2591,19 @@ declare module "dns" { AnySrvRecord | AnyTxtRecord; - export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; - export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; - export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; - export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void): void; + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve { @@ -2617,9 +2617,9 @@ declare module "dns" { export function __promisify__(hostname: string, rrtype: string): Promise; } - export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve4 { @@ -2628,9 +2628,9 @@ declare module "dns" { export function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; - export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; - export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace resolve6 { @@ -2639,52 +2639,52 @@ declare module "dns" { export function __promisify__(hostname: string, options?: ResolveOptions): Promise; } - export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; export namespace resolveCname { export function __promisify__(hostname: string): Promise; } - export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; export namespace resolveMx { export function __promisify__(hostname: string): Promise; } - export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; export namespace resolveNaptr { export function __promisify__(hostname: string): Promise; } - export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; export namespace resolveNs { export function __promisify__(hostname: string): Promise; } - export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; export namespace resolvePtr { export function __promisify__(hostname: string): Promise; } - export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; export namespace resolveSoa { export function __promisify__(hostname: string): Promise; } - export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; export namespace resolveSrv { export function __promisify__(hostname: string): Promise; } - export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; export namespace resolveTxt { export function __promisify__(hostname: string): Promise; } - export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; export namespace resolveAny { export function __promisify__(hostname: string): Promise; } - export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; export function getServers(): string[]; @@ -2739,7 +2739,7 @@ declare module "net" { import * as events from "events"; import * as dns from "dns"; - type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; + type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null | null, address: string, family: number) => void) => void; export interface SocketConstructorOpts { fd?: number; @@ -3008,7 +3008,7 @@ declare module "dgram" { reuseAddr?: boolean; recvBufferSize?: number; sendBufferSize?: number; - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void) => void; + lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void; } export function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; @@ -3219,7 +3219,7 @@ declare module "fs" { * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - export function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace rename { @@ -3247,14 +3247,14 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param len If not specified, defaults to `0`. */ - export function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous truncate(2) - Truncate a file to a specified length. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - export function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace truncate { @@ -3278,13 +3278,13 @@ declare module "fs" { * @param fd A file descriptor. * @param len If not specified, defaults to `0`. */ - export function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous ftruncate(2) - Truncate a file to a specified length. * @param fd A file descriptor. */ - export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace ftruncate { @@ -3307,7 +3307,7 @@ declare module "fs" { * Asynchronous chown(2) - Change ownership of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace chown { @@ -3328,7 +3328,7 @@ declare module "fs" { * Asynchronous fchown(2) - Change ownership of a file. * @param fd A file descriptor. */ - export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace fchown { @@ -3349,7 +3349,7 @@ declare module "fs" { * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace lchown { @@ -3371,7 +3371,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - export function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + export function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace chmod { @@ -3395,7 +3395,7 @@ declare module "fs" { * @param fd A file descriptor. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - export function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace fchmod { @@ -3419,7 +3419,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. */ - export function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; + export function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace lchmod { @@ -3442,7 +3442,7 @@ declare module "fs" { * Asynchronous stat(2) - Get file status. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace stat { @@ -3463,7 +3463,7 @@ declare module "fs" { * Asynchronous fstat(2) - Get file status. * @param fd A file descriptor. */ - export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace fstat { @@ -3484,7 +3484,7 @@ declare module "fs" { * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; + export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace lstat { @@ -3506,7 +3506,7 @@ declare module "fs" { * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace link { @@ -3532,14 +3532,14 @@ declare module "fs" { * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. */ - export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous symlink(2) - Create a new symbolic link to an existing file. * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. */ - export function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace symlink { @@ -3569,27 +3569,27 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readlink(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + export function readlink(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, linkString: Buffer) => void): void; + export function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string | Buffer) => void): void; + export function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; /** * Asynchronous readlink(2) - read value of a symbolic link. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; + export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace readlink { @@ -3641,27 +3641,27 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function realpath(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + export function realpath(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; + export function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; + export function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; /** * Asynchronous realpath(3) - return the canonicalized absolute pathname. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; + export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace realpath { @@ -3712,7 +3712,7 @@ declare module "fs" { * Asynchronous unlink(2) - delete a name and possibly the file it refers to. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace unlink { @@ -3733,7 +3733,7 @@ declare module "fs" { * Asynchronous rmdir(2) - delete a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace rmdir { @@ -3755,13 +3755,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - export function mkdir(path: PathLike, mode: number | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function mkdir(path: PathLike, mode: number | string | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace mkdir { @@ -3785,27 +3785,27 @@ declare module "fs" { * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + export function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException, folder: Buffer) => void): void; + export function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string | Buffer) => void): void; + export function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; /** * Asynchronously creates a unique temporary directory. * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. */ - export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace mkdtemp { @@ -3857,27 +3857,27 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdir(path: PathLike, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + export function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; + export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace readdir { @@ -3928,7 +3928,7 @@ declare module "fs" { * Asynchronous close(2) - close a file descriptor. * @param fd A file descriptor. */ - export function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function close(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace close { @@ -3950,13 +3950,13 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. */ - export function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + export function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; /** * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. */ - export function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; + export function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace open { @@ -3981,7 +3981,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace utimes { @@ -4008,7 +4008,7 @@ declare module "fs" { * @param atime The last access time. If a string is provided, it will be coerced to number. * @param mtime The last modified time. If a string is provided, it will be coerced to number. */ - export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace futimes { @@ -4033,7 +4033,7 @@ declare module "fs" { * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. * @param fd A file descriptor. */ - export function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function fsync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace fsync { @@ -4057,7 +4057,7 @@ declare module "fs" { * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. */ - export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. @@ -4065,20 +4065,20 @@ declare module "fs" { * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. */ - export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. */ - export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + export function write(fd: number, buffer: TBuffer, offset: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. */ - export function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; + export function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. @@ -4087,7 +4087,7 @@ declare module "fs" { * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. * @param encoding The expected string encoding. */ - export function write(fd: number, string: any, position: number | undefined | null, encoding: string | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, string: any, position: number | undefined | null, encoding: string | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. @@ -4095,14 +4095,14 @@ declare module "fs" { * @param string A string to write. If something other than a string is supplied it will be coerced to a string. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. */ - export function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; /** * Asynchronously writes `string` to the file referenced by the supplied file descriptor. * @param fd A file descriptor. * @param string A string to write. If something other than a string is supplied it will be coerced to a string. */ - export function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace write { @@ -4151,7 +4151,7 @@ declare module "fs" { * @param length The number of bytes to read. * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. */ - export function read(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void): void; + export function read(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null, callback?: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace read { @@ -4182,7 +4182,7 @@ declare module "fs" { * @param options An object that may contain an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -4192,7 +4192,7 @@ declare module "fs" { * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - export function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; /** * Asynchronously reads the entire contents of a file. @@ -4202,14 +4202,14 @@ declare module "fs" { * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. * If a flag is not provided, it defaults to `'r'`. */ - export function readFile(path: PathLike | number, options: { encoding?: string | null; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void): void; + export function readFile(path: PathLike | number, options: { encoding?: string | null; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void): void; /** * Asynchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * If a file descriptor is provided, the underlying file will _not_ be closed automatically. */ - export function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace readFile { @@ -4284,7 +4284,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'w'` is used. */ - export function writeFile(path: PathLike | number, data: any, options: { encoding?: string | null; mode?: number | string; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(path: PathLike | number, data: any, options: { encoding?: string | null; mode?: number | string; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously writes data to a file, replacing the file if it already exists. @@ -4293,7 +4293,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - export function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace writeFile { @@ -4338,7 +4338,7 @@ declare module "fs" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'a'` is used. */ - export function appendFile(file: PathLike | number, data: any, options: { encoding?: string | null, mode?: string | number, flag?: string } | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(file: PathLike | number, data: any, options: { encoding?: string | null, mode?: string | number, flag?: string } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously append data to a file, creating the file if it does not exist. @@ -4347,7 +4347,7 @@ declare module "fs" { * If a file descriptor is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. */ - export function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace appendFile { @@ -4601,14 +4601,14 @@ declare module "fs" { * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - export function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously tests a user's permissions for the file specified by path. * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. * URL support is _experimental_. */ - export function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace access { @@ -4661,7 +4661,7 @@ declare module "fs" { * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. * @param fd A file descriptor. */ - export function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace fdatasync { @@ -4687,7 +4687,7 @@ declare module "fs" { * @param src A path to the source file. * @param dest A path to the destination file. */ - export function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; + export function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. * No arguments other than a possible exception are given to the callback function. @@ -4698,7 +4698,7 @@ declare module "fs" { * @param dest A path to the destination file. * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. */ - export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException) => void): void; + export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException | null) => void): void; // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. export namespace copyFile { @@ -5712,33 +5712,33 @@ declare module "util" { } export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; export function promisify(fn: CustomPromisify): TCustom; export function promisify(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise; - export function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise; + export function promisify(fn: (callback: (err?: Error) => void) => void): () => Promise; export function promisify(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: Error) => void) => void): (arg1: T1) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; export function promisify(fn: Function): Function; export namespace promisify { const custom: symbol; @@ -6369,7 +6369,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?: (err: NodeJS.ErrnoException) => void; + onError?: (err: NodeJS.ErrnoException | null) => void; } export interface Http2Stream extends stream.Duplex { diff --git a/types/oibackoff/index.d.ts b/types/oibackoff/index.d.ts index 4269d178f5..cab5c6588c 100644 --- a/types/oibackoff/index.d.ts +++ b/types/oibackoff/index.d.ts @@ -22,163 +22,163 @@ export function fibonacci(n: number): number; export interface BackoffInstance { ( - fn: (callback: (a: A) => void) => void, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + fn: (callback: (a: A | null) => void) => void, + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (callback: (a: A) => void) => void, - intermediate: BackoffIntermediate, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + fn: (callback: (a: A | null) => void) => void, + intermediate: BackoffIntermediate, + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A) => void) => void, + fn: (p0: P0, callback: (a: A | null) => void) => void, p0: P0, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A) => void) => void, + fn: (p0: P0, callback: (a: A | null) => void) => void, p0: P0, - intermediate: BackoffIntermediate, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null) => void) => void, p0: P0, p1: P1, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null) => void) => void, p0: P0, p1: P1, - intermediate: BackoffIntermediate, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null) => void) => void, p0: P0, p1: P1, p2: P2, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null) => void) => void, p0: P0, p1: P1, p2: P2, - intermediate: BackoffIntermediate, - callback: (a: A, b: null, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: null, priorErrors: A[] | undefined) => void): void; ( - fn: (callback: (a: A, b: B) => void) => void, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + fn: (callback: (a: A | null, b: B) => void) => void, + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (callback: (a: A, b: B) => void) => void, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + fn: (callback: (a: A | null, b: B) => void) => void, + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B) => void) => void, p0: P0, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B) => void) => void, p0: P0, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B) => void) => void, p0: P0, p1: P1, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B) => void) => void, p0: P0, p1: P1, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B) => void) => void, p0: P0, p1: P1, p2: P2, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B) => void) => void, p0: P0, p1: P1, p2: P2, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrors: A[] | undefined) => void): void; ( - fn: (callback: (a: A, b: B, c: C) => void) => void, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + fn: (callback: (a: A | null, b: B, c: C) => void) => void, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (callback: (a: A, b: B, c: C) => void) => void, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + fn: (callback: (a: A | null, b: B, c: C) => void) => void, + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, p1: P1, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, p1: P1, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, p1: P1, p2: P2, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B, c: C) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B, c: C) => void) => void, p0: P0, p1: P1, p2: P2, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined) => void): void; ( - fn: (callback: (a: A, b: B, c: C, d: D) => void) => void, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + fn: (callback: (a: A | null, b: B, c: C, d: D) => void) => void, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (callback: (a: A, b: B, c: C, d: D) => void) => void, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + fn: (callback: (a: A | null, b: B, c: C, d: D) => void) => void, + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, p1: P1, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, p1: P1, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, p1: P1, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, p1: P1, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, p1: P1, p2: P2, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; ( - fn: (p0: P0, p1: P1, p2: P2, callback: (a: A, b: B, c: C, d: D) => void) => void, + fn: (p0: P0, p1: P1, p2: P2, callback: (a: A | null, b: B, c: C, d: D) => void) => void, p0: P0, p1: P1, p2: P2, - intermediate: BackoffIntermediate, - callback: (a: A, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; + intermediate: BackoffIntermediate, + callback: (a: A | null, b: B | null | undefined, priorErrorsOrC: C | A[] | undefined, d: D | undefined) => void): void; } diff --git a/types/oibackoff/oibackoff-tests.ts b/types/oibackoff/oibackoff-tests.ts index 97e8cbd5a6..0e6c8ccd2c 100644 --- a/types/oibackoff/oibackoff-tests.ts +++ b/types/oibackoff/oibackoff-tests.ts @@ -38,7 +38,7 @@ backoff(dns.resolve, 'chilts.org', (err, addresses, priorErrors) => { }); // Example 2 -function intermediate(err: Error, tries: number, delay: number): boolean { +function intermediate(err: Error | null, tries: number, delay: number): boolean { console.log(err); // last error console.log(tries); // total number of tries performed thus far console.log(delay); // the delay for the next attempt diff --git a/types/readdir-enhanced/index.d.ts b/types/readdir-enhanced/index.d.ts index f9d3947ba0..5e9bff6689 100644 --- a/types/readdir-enhanced/index.d.ts +++ b/types/readdir-enhanced/index.d.ts @@ -14,7 +14,7 @@ declare namespace re { } type FilterFunction = (stat: Entry) => boolean; - type Callback = (err: NodeJS.ErrnoException, result: T) => void; + type Callback = (err: NodeJS.ErrnoException | null, result: T) => void; type CallbackString = Callback; type CallbackEntry = Callback; diff --git a/types/rollup-plugin-sourcemaps/index.d.ts b/types/rollup-plugin-sourcemaps/index.d.ts index 8ec039d7ac..13f3a030f4 100644 --- a/types/rollup-plugin-sourcemaps/index.d.ts +++ b/types/rollup-plugin-sourcemaps/index.d.ts @@ -8,7 +8,7 @@ import { Plugin } from 'rollup'; declare namespace sourcemaps { - type ReadFileCallback = (err: NodeJS.ErrnoException, data: string) => void; + type ReadFileCallback = (err: NodeJS.ErrnoException | null, data: string) => void; type ReadFileFunction = (file: string | Buffer | number, encoding: string, callback: ReadFileCallback) => void; interface Options {