-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
65 lines (62 loc) · 1.74 KB
/
types.ts
File metadata and controls
65 lines (62 loc) · 1.74 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file Public type surface for the cross-cutting `env/*` leaves split out of
* the legacy single-file `env.ts` — option bags consumed by `envAsBoolean` /
* `envAsNumber` / `envAsString`. The pre-existing concern-specific leaves in
* this directory (ci, debug, github, …) keep their own ad-hoc types. Pure
* types, no runtime side effects.
*/
/**
* Options for `envAsBoolean`.
*/
export interface EnvAsBooleanOptions {
/**
* Default when value is null/undefined. @default false.
*/
defaultValue?: boolean | undefined
/**
* Whether to trim whitespace from string values before matching. When
* `false`, `' true '` is NOT recognised as truthy — only exact matches.
*
* @default true
*/
trim?: boolean | undefined
}
/**
* Options for `envAsNumber`.
*/
export interface EnvAsNumberOptions {
/**
* Whether to return `±Infinity` when input parses to infinity. When `false`
* (default), infinities and NaN are coerced to `defaultValue`.
*
* @default false
*/
allowInfinity?: boolean | undefined
/**
* Default when value is not a finite number. @default 0.
*/
defaultValue?: number | undefined
/**
* Parse mode. `'int'` (default) uses `parseInt(_, 10)` — integer only.
* `'float'` uses `Number()` — decimals preserved.
*
* @default 'int'
*/
mode?: 'int' | 'float' | undefined
}
/**
* Options for `envAsString`.
*/
export interface EnvAsStringOptions {
/**
* Default when value is null/undefined. @default ''
*/
defaultValue?: string | undefined
/**
* Whether to trim whitespace from string values. `true` (default) trims. Set
* `false` to preserve whitespace (helpers.envAsString semantics).
*
* @default true
*/
trim?: boolean | undefined
}