From cb2189e1848c72edfd7862f67e6e97939e963e02 Mon Sep 17 00:00:00 2001 From: HiromiShikata Date: Thu, 15 Jun 2017 19:59:51 +0900 Subject: [PATCH] feat(fs-extra-promise): add missing interfaces --- types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts | 9 +++++++++ types/fs-extra-promise-es6/index.d.ts | 6 +++++- types/fs-extra-promise/fs-extra-promise-tests.ts | 9 +++++++++ types/fs-extra-promise/index.d.ts | 6 +++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts b/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts index 46e623207a..e789c5627f 100644 --- a/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts +++ b/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts @@ -42,6 +42,7 @@ var openOpts: fs.OpenOptions; var watcher: fs.FSWatcher; var readStreeam: stream.Readable; var writeStream: stream.Writable; +var isDirectory: boolean; fs.copy(src, dest, errorCallback); fs.copy(src, dest, (src: string) => { @@ -222,3 +223,11 @@ writeStream = fs.createWriteStream(path, { flags: str, encoding: str }); + +var isDirectoryCallback = (err: Error, isDirectory: boolean) => { +}; +fs.isDirectory(path, isDirectoryCallback); +fs.isDirectory(path); +isDirectory = fs.isDirectorySync(path); +fs.isDirectoryAsync(path); + diff --git a/types/fs-extra-promise-es6/index.d.ts b/types/fs-extra-promise-es6/index.d.ts index 85055636dc..82ab2da35b 100644 --- a/types/fs-extra-promise-es6/index.d.ts +++ b/types/fs-extra-promise-es6/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for fs-extra-promise-es6 // Project: https://github.com/vinsonchuong/fs-extra-promise-es6 -// Definitions by: midknight41 , Jason Swearingen , Joshua DeVinney +// Definitions by: midknight41 , Jason Swearingen , Joshua DeVinney , Hiromi Shikata // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: fs-extra-promise typings (minus Bluebird) @@ -239,3 +239,7 @@ export declare function appendFileAsync(filename: string, data: any, option?: Op export declare function existsAsync(path: string): Promise; export declare function ensureDirAsync(path: string): Promise; + +export declare function isDirectory(path: string, callback?: (err: Error, isDirectory: boolean) => void): void; +export declare function isDirectorySync(path: string): boolean; +export declare function isDirectoryAsync(path: string): Promise; diff --git a/types/fs-extra-promise/fs-extra-promise-tests.ts b/types/fs-extra-promise/fs-extra-promise-tests.ts index ef8de43ad3..592f61ca87 100644 --- a/types/fs-extra-promise/fs-extra-promise-tests.ts +++ b/types/fs-extra-promise/fs-extra-promise-tests.ts @@ -43,6 +43,7 @@ var writeOpts: fs.WriteOptions; var watcher: fs.FSWatcher; var readStream: stream.Readable; var writeStream: stream.Writable; +var isDirectory: boolean; fs.copy(src, dest, errorCallback); fs.copy(src, dest, (src: string) => { @@ -219,3 +220,11 @@ writeStream = fs.createWriteStream(path, { flags: str, encoding: str }); + +var isDirectoryCallback = (err: Error, isDirectory: boolean) => { +}; +fs.isDirectory(path, isDirectoryCallback); +fs.isDirectory(path); +isDirectory = fs.isDirectorySync(path); +fs.isDirectoryAsync(path); + diff --git a/types/fs-extra-promise/index.d.ts b/types/fs-extra-promise/index.d.ts index b4c9a648ac..36de7fdf19 100644 --- a/types/fs-extra-promise/index.d.ts +++ b/types/fs-extra-promise/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for fs-extra-promise 1.0 // Project: https://github.com/overlookmotel/fs-extra-promise -// Definitions by: midknight41 , Jason Swearingen +// Definitions by: midknight41 , Jason Swearingen , Hiromi Shikata // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -90,3 +90,7 @@ export declare function appendFileAsync(filename: string, data: any, option?: Wr export declare function existsAsync(path: string): Promise; export declare function ensureDirAsync(path: string): Promise; + +export declare function isDirectory(path: string, callback?: (err: Error, isDirectory: boolean) => void): void; +export declare function isDirectorySync(path: string): boolean; +export declare function isDirectoryAsync(path: string): Promise;