Skip to content

Commit bbe9c6c

Browse files
authored
[fs-extra] Make compatible with @types/[email protected] (DefinitelyTyped#51677)
1 parent 0432cce commit bbe9c6c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

types/fs-extra/fs-extra-tests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,9 @@ fs.realpath('src', (err, resolved) => {
299299
fs.realpath.native('src');
300300
// $ExpectType Promise<Buffer>
301301
fs.realpath.native('src', 'buffer');
302+
// $ExpectType Promise<string>
303+
fs.realpath.native('src', { encoding: 'utf-8' });
304+
// $ExpectType Promise<Buffer>
305+
fs.realpath.native('src', { encoding: 'buffer' });
306+
// $ExpectType Promise<string>
307+
fs.realpath.native('src', { encoding: null });

types/fs-extra/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ export function realpath(path: PathLike, cache?: { [path: string]: string }): Pr
229229
/* tslint:disable:unified-signatures */
230230
export namespace realpath {
231231
const native: {
232-
(path: PathLike, options: fs.BaseEncodingOptions | BufferEncoding | undefined | null): Promise<string>;
233-
(path: PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
234-
(path: PathLike, options: fs.BaseEncodingOptions | string | undefined | null): Promise<string | Buffer>;
232+
(path: PathLike, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null): Promise<string>;
233+
(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
234+
(path: PathLike, options: { encoding: BufferEncoding | null } | string | undefined | null): Promise<string | Buffer>;
235235
(path: PathLike): Promise<string>;
236236
} & typeof fs.realpath.native;
237237
}

0 commit comments

Comments
 (0)