1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | declare function which(
|
10 | cmd: string,
|
11 | options: which.AsyncOptions & which.OptionsAll,
|
12 | cb: (err: Error | null, paths: ReadonlyArray<string> | undefined) => void,
|
13 | ): void;
|
14 | declare function which(
|
15 | cmd: string,
|
16 | options: which.AsyncOptions & which.OptionsFirst,
|
17 | cb: (err: Error | null, path: string | undefined) => void,
|
18 | ): void;
|
19 | declare function which(
|
20 | cmd: string,
|
21 | options: which.AsyncOptions,
|
22 | cb: (err: Error | null, path: string | ReadonlyArray<string> | undefined) => void,
|
23 | ): void;
|
24 | declare function which(cmd: string, cb: (err: Error | null, path: string | undefined) => void): void;
|
25 | declare function which(cmd: string, options: which.AsyncOptions & which.OptionsAll): Promise<string[]>;
|
26 | declare function which(cmd: string, options?: which.AsyncOptions & which.OptionsFirst): Promise<string>;
|
27 |
|
28 | declare namespace which {
|
29 |
|
30 | function sync(cmd: string, options: Options & OptionsAll & OptionsNoThrow): ReadonlyArray<string> | null;
|
31 | function sync(cmd: string, options: Options & OptionsFirst & OptionsNoThrow): string | null;
|
32 | function sync(cmd: string, options: Options & OptionsAll & OptionsThrow): ReadonlyArray<string>;
|
33 | function sync(cmd: string, options?: Options & OptionsFirst & OptionsThrow): string;
|
34 | function sync(cmd: string, options: Options): string | ReadonlyArray<string> | null;
|
35 |
|
36 |
|
37 | interface OptionsAll extends AsyncOptions {
|
38 | all: true;
|
39 | }
|
40 |
|
41 |
|
42 | interface OptionsFirst extends AsyncOptions {
|
43 | all?: false;
|
44 | }
|
45 |
|
46 |
|
47 | interface OptionsNoThrow extends Options {
|
48 | nothrow: true;
|
49 | }
|
50 |
|
51 |
|
52 | interface OptionsThrow extends Options {
|
53 | nothrow?: false;
|
54 | }
|
55 |
|
56 |
|
57 | interface AsyncOptions {
|
58 |
|
59 | all?: boolean;
|
60 |
|
61 | path?: string;
|
62 |
|
63 | pathExt?: string;
|
64 | }
|
65 |
|
66 |
|
67 | interface Options extends AsyncOptions {
|
68 |
|
69 | nothrow?: boolean;
|
70 | }
|
71 | }
|
72 |
|
73 | export = which;
|