effect-io-ai

Package: effect
Module: SchemaGetter

SchemaGetter.required

Creates a getter that fails with MissingKey if the input is absent (Option.None).

When to use

Use when you need a schema getter to require a struct field in the encoded input and report a missing key error when it is absent.

Details

Example (Defining a required struct field)

import { SchemaGetter } from "effect"

const mustExist = SchemaGetter.required<string>()

See

Signature

declare const required: <T, E extends T = T>(annotations?: Schema.Annotations.Key<T>) => Getter<T, E>

Source

Since v4.0.0