-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
34 lines (28 loc) · 789 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
export interface Config<T> {
filePath: string;
raw: any;
value: T;
}
export interface merge<T1, T2 = T1> {
(x: Partial<T1>, y: Partial<T2>): T1 & T2;
}
export interface LoadOptions<T> {
cwd?: string;
context?: any;
merge?: merge<T>;
}
export interface Plugin {
name: string;
extensions?: string[];
fileNames?: string[];
/** Executed before require/import of config file */
register?(filePath: string): Promise<void>;
/** Modify the config file before passing it along */
transform?(module: any): Promise<any>;
}
interface Load<T extends Record<any, any> = Record<any, any>> {
(namespace: string, opts?: LoadOptions<T>): Promise<Config<T>>;
use(plugins: Plugin[]): void;
}
declare const load: Load;
export default load;