<S extends Schema.ConstraintDecoder<unknown>>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: S["Encoded"],
options?: SchemaAST.ParseOptions
) => Result.Result<S["Type"], SchemaIssue.Issue>Creates a decoder for input already typed as the schema's Encoded type,
reporting failure safely as a Result.
When to use
Use when you already have input typed as the schema's Encoded type and want
schema decoding failures represented as Result.fail with SchemaIssue.Issue.
Details
The returned function produces Result.succeed with the decoded Type on
success or Result.fail with a SchemaIssue.Issue on decoding failure.
Gotchas
This synchronous adapter returns Result.fail for causes made entirely of
schema issues, but causes that contain defects, interruptions, or other
non-schema reasons throw instead.
export const const decodeResult: <
S extends Schema.ConstraintDecoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
) => (
input: S["Encoded"],
options?: SchemaAST.ParseOptions
) => Result.Result<S["Type"], SchemaIssue.Issue>
Creates a decoder for input already typed as the schema's Encoded type,
reporting failure safely as a Result.
When to use
Use when you already have input typed as the schema's Encoded type and want
schema decoding failures represented as Result.fail with SchemaIssue.Issue.
Details
The returned function produces Result.succeed with the decoded Type on
success or Result.fail with a SchemaIssue.Issue on decoding failure.
Gotchas
This synchronous adapter returns Result.fail for causes made entirely of
schema issues, but causes that contain defects, interruptions, or other
non-schema reasons throw instead.
decodeResult: <function (type parameter) S in <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue>S extends import SchemaSchema.type Schema.ConstraintDecoder = /*unresolved*/ anyConstraintDecoder<unknown>>(
schema: S extends Schema.ConstraintDecoder<unknown>schema: function (type parameter) S in <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions
) => (input: S["Encoded"]input: function (type parameter) S in <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue>S["Encoded"], options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions) => import ResultResult.type Result.Result = /*unresolved*/ anyResult<function (type parameter) S in <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue>S["Type"], import SchemaIssueSchemaIssue.type SchemaIssue.Issue = /*unresolved*/ anyIssue> =
function decodeUnknownResult<
S extends Schema.ConstraintDecoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Result.Result<S["Type"], SchemaIssue.Issue>
Creates a decoder for unknown input that reports failure safely as a
Result.
When to use
Use when decoding untyped boundary input and you want SchemaIssue.Issue
failures returned as data in a Result.
Details
The returned function produces Result.succeed with the decoded Type on
success or Result.fail with a SchemaIssue.Issue on decoding failure.
Gotchas
This adapter runs synchronously. Causes made entirely of schema issues become
Result.fail, but causes that contain defects, interruptions, or asynchronous
work at this synchronous boundary throw instead.
decodeUnknownResult