Skip to content

StructuredSource

StructuredSource = object

Defined in: types.ts:46

A source whose load() returns an arbitrary, possibly nested value — objects, arrays, functions, sub-objects — rather than a flat string map.

This is what unlocks module-based config (e.g. app.config.ts whose default export is a nested object). loadConfig treats structured sources differently from flat ConfigSources:

  • No string coercion. The value is merged as-is.
  • Deep merge. Plain objects are merged recursively against earlier sources; arrays and primitives replace wholesale.
  • No value redaction in validation errors — structured config files are typically public, not secret-bearing env.

load() must resolve to a plain object (or null/undefined, treated as “empty” so defaults apply). Returning any other non-nullish value (array, primitive, function) is a configuration error and throws.

load: () => unknown | Promise<unknown>

Defined in: types.ts:52

Read the structured value (typically a module’s default export).

unknown | Promise<unknown>


name: string

Defined in: types.ts:48

Identifier used in diagnostics.


structured: true

Defined in: types.ts:50

Discriminator marking this as a structured (nested) source.