Skip to content

objectenvy / ConfigValue

Type Alias: ConfigValue

ts
type ConfigValue = EnviablePrimitive | ConfigObject | EnviableArray;

Defined in: types.ts:48

A single configuration value — either a primitive string/number/boolean, an array of primitives/objects, or a nested ConfigObject. Exported as ConfigValue.

Remarks

This union type covers every value shape that objectify() can produce. When coerce: true (the default), string values from process.env may become number or boolean at runtime. When comma-separated, they become arrays. Deeply nested objects arise when multiple env keys share a prefix (or when a schema mandates nesting).

Example

ts
import type { ConfigValue } from 'objectenvy';
const v: ConfigValue = 3000;                   // number
const v2: ConfigValue = true;                  // boolean
const v3: ConfigValue = 'debug';               // string
const v4: ConfigValue = ['a', 'b'];            // array
const v5: ConfigValue = { host: 'localhost' }; // nested object

Released under the MIT License.