<S extends Schema.Constraint>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>Creates an effectful encoder for input already typed as the schema's decoded
Type.
When to use
Use when you need to encode values already typed as the schema's decoded
Type in an Effect whose failure channel is SchemaIssue.Issue, while
preserving service requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue, preserving any encoding service requirements in the
returned Effect.
export const const encodeEffect: <
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
) => (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Encoded"],
SchemaIssue.Issue,
S["EncodingServices"]
>
Creates an effectful encoder for input already typed as the schema's decoded
Type.
When to use
Use when you need to encode values already typed as the schema's decoded
Type in an Effect whose failure channel is SchemaIssue.Issue, while
preserving service requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue, preserving any encoding service requirements in the
returned Effect.
encodeEffect: <function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S extends import SchemaSchema.type Schema.Constraint = /*unresolved*/ anyConstraint>(
schema: S extends Schema.Constraintschema: function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions
) => (
input: S["Type"]input: function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["Type"],
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.type SchemaAST.ParseOptions = /*unresolved*/ anyParseOptions
) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["Encoded"], import SchemaIssueSchemaIssue.type SchemaIssue.Issue = /*unresolved*/ anyIssue, function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["EncodingServices"]> = function encodeUnknownEffect<
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Encoded"],
SchemaIssue.Issue,
S["EncodingServices"]
>
Creates an effectful encoder for unknown input.
When to use
Use when you need to encode untyped boundary input in an Effect whose
failure channel is SchemaIssue.Issue, while preserving service
requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue. Encoding service requirements are preserved in the returned
Effect. Parse options may be provided when creating the encoder and overridden
when applying it.
encodeUnknownEffect