effect-io-ai

Package: effect
Module: SchemaParser

SchemaParser.encodeEffect

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.

See

Signature

declare 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"]>

Source

Since v4.0.0