effect-io-ai

Package: effect
Module: Config

Config.option

Makes a config optional: returns Some(value) on success and None when data is missing.

When to use

Use when you need to handle a config key that may or may not be present.

Gotchas

Like withDefault, only missing-data errors produce None. Validation errors still propagate.

Example (Reading optional config)

import { Config, ConfigProvider, Effect } from "effect"

const maybePort = Config.option(Config.number("port"))

const provider = ConfigProvider.fromUnknown({})
// Effect.runSync(maybePort.parse(provider)) // { _tag: "None" }

See

Signature

declare const option: <A>(self: Config<A>) => Config<Option.Option<A>>

Source

Since v2.0.0