Package: effect
Module: SchemaIssue
Extracts the actual input value from any Issue variant.
When to use
Use when you need to retrieve an Issue’s offending input value for logging
or custom error rendering.
Details
Option.none() for Pointer and MissingKey (they carry no
value).Option for variants that already store actual as
Option<unknown> (InvalidType, InvalidValue, Forbidden, Encoding,
Composite).actual with Option.some for variants that store it as plain
unknown (AnyOf, UnexpectedKey, OneOf, Filter).Example (Extracting the actual value)
import { Option, SchemaIssue } from "effect"
const issue = new SchemaIssue.MissingKey(undefined)
console.log(SchemaIssue.getActual(issue))
// { _tag: "None" }
See
IssueisIssueSignature
declare const getActual: (issue: Issue) => Option.Option<unknown>
Since v4.0.0