<S extends Schema.ConstraintDecoder<unknown>>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Type"], SchemaIssue.Issue>Creates a synchronous decoder for unknown input that reports failure safely
as an Exit.
When to use
Use when you need to decode unknown input synchronously into an Exit whose
failure contains SchemaIssue.Issue.
Details
The returned function produces Exit.Success with the decoded Type.
Schema issues are represented by an Exit.Failure cause containing a
SchemaIssue.Issue.
Gotchas
Because this adapter runs synchronously, async decoding work can produce an
Exit.Failure with a defect cause. When the cause contains both schema
issues and non-schema reasons, all reasons remain in the returned Cause.
export function function decodeUnknownExit<
S extends Schema.ConstraintDecoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Type"], SchemaIssue.Issue>
Creates a synchronous decoder for unknown input that reports failure safely
as an Exit.
When to use
Use when you need to decode unknown input synchronously into an Exit whose
failure contains SchemaIssue.Issue.
Details
The returned function produces Exit.Success with the decoded Type.
Schema issues are represented by an Exit.Failure cause containing a
SchemaIssue.Issue.
Gotchas
Because this adapter runs synchronously, async decoding work can produce an
Exit.Failure with a defect cause. When the cause contains both schema
issues and non-schema reasons, all reasons remain in the returned Cause.
decodeUnknownExit<function (type parameter) S in decodeUnknownExit<S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue>S extends import SchemaSchema.interface ConstraintDecoder<out T, out RD = never>Lightweight structural constraint for APIs that need decoder type views but
do not need the full schema protocol.
When to use
Use when you need to preserve a schema's decoded type and decoding services,
but the API does not constrain the encoded type, encoding services, or call
schema methods such as annotate, check, rebuild, make, or
makeEffect.
ConstraintDecoder<unknown>>(
schema: S extends Schema.ConstraintDecoder<unknown>schema: function (type parameter) S in decodeUnknownExit<S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
): (input: unknowninput: unknown, options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions) => import ExitExit.type Exit<A, E = never> = Exit.Success<A, E> | Exit.Failure<A, E>Represents the result of an Effect computation.
When to use
Use when you need to synchronously inspect whether an Effect computation
succeeded or failed.
Details
An Exit<A, E> is either Success<A, E> containing a value of type A, or
Failure<A, E> containing a Cause<E> describing why the computation
failed.
Since Exit is also an Effect, you can yield it inside Effect.gen.
Example (Pattern matching on an Exit)
import { Exit } from "effect"
const success: Exit.Exit<number> = Exit.succeed(42)
const failure: Exit.Exit<number, string> = Exit.fail("error")
const result = Exit.match(success, {
onSuccess: (value) => `Got value: ${value}`,
onFailure: (cause) => `Got error: ${cause}`
})
Namespace containing helper types shared by Exit values.
When to use
Use to reference helper types that describe the shared structure of Exit
values.
Exit<function (type parameter) S in decodeUnknownExit<S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue>S["Type"], import SchemaIssueSchemaIssue.type Issue =
| SchemaIssue.Leaf
| SchemaIssue.Filter
| SchemaIssue.Encoding
| SchemaIssue.Pointer
| SchemaIssue.Composite
| SchemaIssue.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> {
return function asExit<T, E, R>(
parser: (
input: E,
options?: SchemaAST.ParseOptions
) => Effect.Effect<T, SchemaIssue.Issue, R>
): (
input: E,
options?: SchemaAST.ParseOptions
) => Exit.Exit<T, SchemaIssue.Issue>
asExit(function decodeUnknownEffect<
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
S["DecodingServices"]
>
Creates an effectful decoder for unknown input.
When to use
Use when you need to decode untyped boundary input in an Effect whose
failure channel is SchemaIssue.Issue, while preserving transformations
and service requirements.
Details
The returned function succeeds with the schema's decoded Type or fails with a
SchemaIssue.Issue. Decoding service requirements are preserved in the returned
Effect. Parse options may be provided when creating the decoder and overridden
when applying it.
decodeUnknownEffect(schema: S extends Schema.ConstraintDecoder<unknown>schema, options: SchemaAST.ParseOptionsoptions))
}