forked from lukeed/mri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
44 lines (40 loc) · 975 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
type Dict<T> = Record<string, T>;
type Arrayable<T> = T | T[];
/** {@link https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts} */
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
declare function mri<
TBoolean extends string = never,
TString extends string = never
>(
args?: string[],
options?: {
boolean?: Arrayable<TBoolean>;
string?: Arrayable<TString>;
alias?: Dict<Arrayable<string>>;
default?: Dict<any>;
unknown?(flag: string): void;
}
): mri.Argv<TBoolean, TString>;
declare namespace mri {
export interface Options {
boolean?: Arrayable<string>;
string?: Arrayable<string>;
alias?: Dict<Arrayable<string>>;
default?: Dict<any>;
unknown?(flag: string): void;
}
export type Argv<
TBoolean extends string = never,
TString extends string = never
> = Simplify<
{
[P in TBoolean]?: boolean;
} & {
[P in TString]?: string;
} & {
[x: string]: any;
_: string[];
}
>;
}
export = mri;