diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 3bd66e44cf..a2c4cb43d3 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -103,13 +103,9 @@ export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoExcept export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; export function access(path: string | Buffer, mode?: number): Promise; -export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number | 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, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise; -export function appendFile(fd: number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; -export function appendFile(fd: number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; -export function appendFile(fd: number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise; - +export function appendFile(filename: string | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; +export function appendFile(filename: string | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function appendFile(filename: string | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise; export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; export function chmod(path: string | Buffer, mode: string | number): Promise; @@ -177,21 +173,13 @@ export function open(path: string | Buffer, flags: string | number, mode?: numbe 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): Promise<[number, Buffer]>; -export function readFile(filename: string, 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, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; -export function readFile(filename: string, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise; +export function readFile(filename: string | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; +export function readFile(filename: string | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; +export function readFile(filename: string | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; +export function readFile(filename: string | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise; // tslint:disable-next-line:unified-signatures -export function readFile(filename: string, encoding: string): Promise; -export function readFile(filename: string): Promise; - -export function readFile(fd: number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; -export function readFile(fd: number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; -export function readFile(fd: number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; -export function readFile(fd: number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise; -// tslint:disable-next-line:unified-signatures -export function readFile(fd: number, encoding: string): Promise; -export function readFile(fd: number): Promise; +export function readFile(filename: string | number, encoding: string): Promise; +export function readFile(filename: string | number): Promise; export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; export function readdir(path: string | Buffer): Promise; @@ -247,13 +235,9 @@ export function write(fd: number, data: any, offset: number, encoding: string, c export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): Promise<[number, Buffer]>; export function write(fd: number, data: any, offset: number, encoding?: string): Promise<[number, string]>; -export function writeFile(filename: string, data: any, 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?: number; flag?: string; }): Promise; - -export function writeFile(fd: number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; -export function writeFile(fd: number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; -export function writeFile(fd: number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise; +export function writeFile(filename: string | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function writeFile(filename: string | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; +export function writeFile(filename: string | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise; /** * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.