Skip to content

API reference / @backpack/config / loadConfig

Function: loadConfig()

ts
function loadConfig<T>(options): Promise<TypeOf<T>>;

Loads the config from the specified loaders.

  • If multiple loaders are provided, it will deep-merge the data from all loaders, with the last loader taking precedence.
  • If any loader fails, it will still return the data from other loaders.

Type Parameters

Type Parameter
T extends AnyZodObject

Parameters

ParameterTypeDescription
optionsLoadConfigOptions<T>The options for loading the config.

Returns

Promise<TypeOf<T>>

The parsed config.

Throws

Throws a ZodError when the resolved configuration object could not be parsed.