Hyperlinkv0.8.0-beta.28

Config

Config.literalfunctioneffect/Config.ts:1016
<L extends SchemaAST.LiteralValue>(literal: L, name?: string): Config<L>

Creates a config that only accepts a specific literal value.

When to use

Use to restrict a config to a single, specific literal value.

Details

Shortcut for Config.schema(Schema.Literal(literal), name).

Example (Restricting to a literal)

import { Config } from "effect"

const env = Config.literal("production", "ENV")
constructorsliterals
Source effect/Config.ts:10163 lines
export function literal<L extends SchemaAST.LiteralValue>(literal: L, name?: string) {
  return schema(Schema.Literal(literal), name)
}