<S extends ConstraintEncoder<unknown>>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Option_.Option<S["Encoded"]>Encodes an unknown input against a schema, returning an Option that is
Some with the encoded value on success or None for schema mismatches.
When to use
Use when you do not know the input type statically and only need to know whether encoding succeeded.
Details
Prefer this over encodeUnknownExit or encodeUnknownEffect
when you don't need error details. For values already typed as the schema's
Type use encodeOption.
Options may be provided either when creating the encoder or when applying it;
application options override creation options.
Gotchas
Only causes made entirely of schema issues are converted to None. Causes
that contain defects, interruptions, or other non-schema reasons throw
instead.
export const const encodeUnknownOption: <
S extends ConstraintEncoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
) => (
input: unknown,
options?: SchemaAST.ParseOptions
) => Option_.Option<S["Encoded"]>
Encodes an unknown input against a schema, returning an Option that is
Some with the encoded value on success or None for schema mismatches.
When to use
Use when you do not know the input type statically and only need to know
whether encoding succeeded.
Details
Prefer this over
encodeUnknownExit
or
encodeUnknownEffect
when you don't need error details. For values already typed as the schema's
Type use
encodeOption
.
Options may be provided either when creating the encoder or when applying it;
application options override creation options.
Gotchas
Only causes made entirely of schema issues are converted to None. Causes
that contain defects, interruptions, or other non-schema reasons throw
instead.
encodeUnknownOption: <function (type parameter) S in <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>S extends interface ConstraintEncoder<out E, out RE = never>Lightweight structural constraint for APIs that need encoder type views but
do not need the full schema protocol.
When to use
Use when you need to preserve a schema's encoded type and encoding services,
but the API does not constrain the decoded type, decoding services, or call
schema methods such as annotate, check, rebuild, make, or
makeEffect.
ConstraintEncoder<unknown>>(
schema: S extends ConstraintEncoder<unknown>schema: function (type parameter) S in <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
) => (input: unknowninput: unknown, options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions) => import Option_Option_.type Option_.Option = /*unresolved*/ anyOption<function (type parameter) S in <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>S["Encoded"]> =
import SchemaParserSchemaParser.function encodeUnknownOption<
S extends Schema.ConstraintEncoder<unknown>
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Option.Option<S["Encoded"]>
encodeUnknownOption