diff --git a/types/which/index.d.ts b/types/which/index.d.ts index edfbc8b366..22513f5acc 100644 --- a/types/which/index.d.ts +++ b/types/which/index.d.ts @@ -13,6 +13,10 @@ declare function which(cmd: string, options: which.AsyncOptions & which.OptionsF declare function which(cmd: string, options: which.AsyncOptions, cb: (err: Error | null, path: string | Array | undefined) => void): void; /** Finds the first instance of a specified executable in the PATH environment variable */ declare function which(cmd: string, cb: (err: Error | null, path: string | undefined) => void): void; +/** Finds the first instance of a specified executable in the PATH environment variable */ +declare function which(cmd: string, options: which.AsyncOptions & which.OptionsAll): Promise; +/** Finds the first instance of a specified executable in the PATH environment variable */ +declare function which(cmd: string, options?: which.AsyncOptions & which.OptionsFirst): Promise; declare namespace which { /** Finds all instances of a specified executable in the PATH environment variable */ function sync(cmd: string, options: which.Options & which.OptionsAll & which.OptionsNoThrow): Array | null; diff --git a/types/which/which-tests.ts b/types/which/which-tests.ts index 0220c3ad14..ca4e0475e4 100644 --- a/types/which/which-tests.ts +++ b/types/which/which-tests.ts @@ -17,6 +17,10 @@ which("cat", {all: true}, (err, paths) => { } }); +var promise: Promise = which("cat"); +var promise1: Promise = which("cat", { all: false }); +var promise2: Promise = which("cat", { all: true }); + var paths = which.sync("cat", {all: true}); for(let path of paths) { console.log(path);