Package: effect
Module: SchemaTransformation
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
Transformation.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
transform — simpler constructor from pure functionstransformOrFail — constructor from effectful functionsTransformationSignature
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>
Since v3.10.0