<S extends Schema.ConstraintEncoder<unknown>>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>Creates a synchronous encoder for input already typed as the schema's decoded
Type, reporting failure safely as an Exit.
When to use
Use when you need synchronous encoding of already typed schema values into
an Exit whose failure contains SchemaIssue.Issue.
Details
The returned function produces Exit.Success with the schema's Encoded value
or Exit.Failure with a SchemaIssue.Issue.
Gotchas
Because this adapter runs synchronously, async encoding 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 const const encodeExit: <
S extends Schema.ConstraintEncoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
) => (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>
Creates a synchronous encoder for input already typed as the schema's decoded
Type, reporting failure safely as an Exit.
When to use
Use when you need synchronous encoding of already typed schema values into
an Exit whose failure contains SchemaIssue.Issue.
Details
The returned function produces Exit.Success with the schema's Encoded value
or Exit.Failure with a SchemaIssue.Issue.
Gotchas
Because this adapter runs synchronously, async encoding 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.
encodeExit: <function (type parameter) S in <S extends Schema.ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>S extends import SchemaSchema.type Schema.ConstraintEncoder = /*unresolved*/ anyConstraintEncoder<unknown>>(
schema: S extends Schema.ConstraintEncoder<unknown>schema: function (type parameter) S in <S extends Schema.ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions
) => (input: S["Type"]input: function (type parameter) S in <S extends Schema.ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>S["Type"], options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions) => import ExitExit.type Exit.Exit = /*unresolved*/ anyExit<function (type parameter) S in <S extends Schema.ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>S["Encoded"], import SchemaIssueSchemaIssue.type SchemaIssue.Issue = /*unresolved*/ anyIssue> =
function encodeUnknownExit<
S extends Schema.ConstraintEncoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Encoded"], SchemaIssue.Issue>
Creates a synchronous encoder for unknown input that reports failure safely
as an Exit.
When to use
Use when you need synchronous encoding of unknown input into an Exit whose
failure contains SchemaIssue.Issue.
Details
The returned function produces Exit.Success with the schema's Encoded value
or Exit.Failure with a SchemaIssue.Issue.
Gotchas
Because this adapter runs synchronously, async encoding 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.
encodeUnknownExit