<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.
export function 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<function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>S extends import SchemaSchema.Constraint>(
schema: S extends Schema.Constraintschema: function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
): (
input: unknowninput: unknown,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>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, function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>S["DecodingServices"]> {
const const parser: (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
S["DecodingServices"]
>
parser = function run<T, R>(
ast: SchemaAST.AST
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<T, SchemaIssue.Issue, R>
run<function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>S["Type"], function (type parameter) S in decodeUnknownEffect<S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>S["DecodingServices"]>(schema: S extends Schema.Constraintschema.Constraint["ast"]: SchemaAST.ASTast)
return options: SchemaAST.ParseOptionsoptions === var undefinedundefined
? const parser: (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
S["DecodingServices"]
>
parser
: (input: unknowninput, overrideOptions: SchemaAST.ParseOptions | undefinedoverrideOptions) => const parser: (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
S["DecodingServices"]
>
parser(input: unknowninput, const mergeParseOptions: (
options: SchemaAST.ParseOptions,
overrideOptions:
| SchemaAST.ParseOptions
| undefined
) => SchemaAST.ParseOptions
mergeParseOptions(options: SchemaAST.ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options, overrideOptions: SchemaAST.ParseOptions | undefinedoverrideOptions))
}