effect-io-ai

Package: effect
Module: Config

Config.literals

Creates a config that only accepts one of the specified literal values.

When to use

Use to restrict a config to a fixed set of allowed literal values.

Details

Shortcut for Config.schema(Schema.Literals(literals), name).

Example (Restricting to a set of literals)

import { Config } from "effect"

const env = Config.literals(["development", "production"], "ENV")

See

Signature

declare const literals: <const L extends ReadonlyArray<SchemaAST.LiteralValue>>(literals: L, name?: string) => Config<L[number]>

Source

Since v4.0.0