(issue: Issue): Option.Option<unknown>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
- Returns
Option.none()forPointerandMissingKey(they carry no value). - Returns the existing
Optionfor variants that already storeactualasOption<unknown>(InvalidType,InvalidValue,Forbidden,Encoding,Composite). - Wraps
actualwithOption.somefor variants that store it as plainunknown(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" }export function function getActual(
issue: Issue
): Option.Option<unknown>
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
- Returns
Option.none() for Pointer and MissingKey (they carry no
value).
- Returns the existing
Option for variants that already store actual as
Option<unknown> (InvalidType, InvalidValue, Forbidden, Encoding,
Composite).
- Wraps
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" }
getActual(issue: Issueissue: type Issue =
| Leaf
| Filter
| Encoding
| Pointer
| Composite
| AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue): import OptionOption.type Option.Option = /*unresolved*/ anyOption<unknown> {
switch (issue: Issueissue._tag: | "Filter"
| "Encoding"
| "Pointer"
| "MissingKey"
| "UnexpectedKey"
| "Composite"
| "InvalidType"
| "InvalidValue"
| "Forbidden"
| "AnyOf"
| "OneOf"
_tag) {
case "Pointer":
case "MissingKey":
return import OptionOption.none()
case "InvalidType":
case "InvalidValue":
case "Forbidden":
case "Encoding":
case "Composite":
return issue: Issueissue.actual: Option.Option<unknown>The input value that caused the issue.
The value that caused the issue.
actual
case "AnyOf":
case "UnexpectedKey":
case "OneOf":
case "Filter":
return import OptionOption.some(issue: Issueissue.actual: unknownThe input value that caused the issue.
actual)
}
}