Hyperlinkv0.8.0-beta.28

Schema

Schema.encodeEffectconsteffect/Schema.ts:1868
<S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions): (
  input: S["Type"],
  options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>

Encodes a typed input (the schema's Type) against a schema, returning an Effect that succeeds with the encoded value or fails with a SchemaError.

When to use

Use when you need to encode input already typed as the schema's Type in an Effect whose failure channel is SchemaError.

Details

For unknown input use encodeUnknownEffect. Options may be provided either when creating the encoder or when applying it; application options override creation options.

Source effect/Schema.ts:18687 lines
export const encodeEffect: <S extends Constraint>(
  schema: S,
  options?: SchemaAST.ParseOptions
) => (
  input: S["Type"],
  options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]> = encodeUnknownEffect
Referenced by 3 symbols