|
1 | 1 |
|
2 |
| -declare function E (varName: string, defaultValue?: string): E.IVariable; |
3 |
| - |
4 |
| -declare namespace E { |
5 |
| - |
6 |
| - interface IVariable { |
7 |
| - required: () => IVariable, |
8 |
| - asInt: () => number, |
9 |
| - asFloat: () => number, |
10 |
| - asPositiveInt: () => number, |
11 |
| - asNegativeInt: () => number, |
12 |
| - asString: () => string, |
13 |
| - asJson: () => Object|Array<any>, |
14 |
| - asBool: () => boolean, |
15 |
| - asStrictBool: () => boolean, |
16 |
| - } |
| 2 | +export interface IPresentVariable { |
| 3 | + asFloat: () => number; |
| 4 | + asInt: () => number; |
| 5 | + asPositiveInt: () => number; |
| 6 | + asNegativeInt: () => number; |
| 7 | + asString: () => string; |
| 8 | + asJson: () => Object|Array<any>; |
| 9 | + asBool: () => boolean; |
| 10 | + asStrictBool: () => boolean; |
| 11 | +} |
17 | 12 |
|
18 |
| - function mock (mockValues: Object): (varName: string, defaultValue?: string) => E.IVariable; |
| 13 | +export interface IOptionalVariable { |
| 14 | + required: () => IPresentVariable; |
| 15 | + asFloat: () => number|undefined; |
| 16 | + asInt: () => number|undefined; |
| 17 | + asPositiveInt: () => number|undefined; |
| 18 | + asNegativeInt: () => number|undefined; |
| 19 | + asString: () => string|undefined; |
| 20 | + asJson: () => Object|Array<any>|undefined; |
| 21 | + asBool: () => boolean|undefined; |
| 22 | + asStrictBool: () => boolean|undefined; |
| 23 | +} |
19 | 24 |
|
| 25 | +export interface IEnv { |
| 26 | + (): Object, |
| 27 | + (varName: string): IOptionalVariable; |
| 28 | + (varName: string, defaultValue: string): IPresentVariable; |
| 29 | + mock(mockVars: Object): IEnv; |
20 | 30 | }
|
21 | 31 |
|
22 |
| -export = E; |
| 32 | +export const env: IEnv; |
| 33 | +export default env; |
0 commit comments