effect-io-ai

Package: effect
Module: SchemaTransformation

SchemaTransformation.make

Constructs a Transformation from an object with decode and encode Getters. If the input is already a Transformation, returns it as-is.

When to use

Use when you already have schema getter instances and want to pair them into a schema transformation.

Details

Example (Wrapping existing getters)

import { SchemaGetter, SchemaTransformation } from "effect"

const t = SchemaTransformation.make({
  decode: SchemaGetter.transform<number, string>((s) => Number(s)),
  encode: SchemaGetter.transform<string, number>((n) => String(n))
})

See

Signature

declare const make: <T, E, RD = never, RE = never>(options: { readonly decode: SchemaGetter.Getter<T, E, RD>; readonly encode: SchemaGetter.Getter<E, T, RE>; }) => Transformation<T, E, RD, RE>

Source

Since v3.10.0