effect-io-ai

Package: effect
Module: Config

Config.unwrap

Constructs a Config<T> from a value matching Wrap<T>.

When to use

Use when accepting config from callers who may pass either a single Config or a record of individual Configs.

Details

If the input is already a Config, it is returned as-is. Otherwise, each key is recursively unwrapped and combined.

Example (Unwrapping a record of configs)

import { Config } from "effect"

interface Options {
  key: string
}

const makeConfig = (config: Config.Wrap<Options>): Config.Config<Options> =>
  Config.unwrap(config)

See

Signature

declare const unwrap: <T>(wrapped: Wrap<T>) => Config<T>

Source

Since v2.0.0