<T, E>(options: { readonly strict: false }): Transformation<T, E>
<T>(): Transformation<T, T>Transforms values by returning the input unchanged in both directions.
When to use
Use when you need a schema transformation to connect two schemas that share the same type with no actual conversion.
Details
- Both decode and encode are no-ops.
- Returns a shared singleton instance (no allocation per call).
- By default,
TandEmust be the same type. Pass{ strict: false }to bypass the type constraint.
Example (Chaining schemas with no conversion)
import { Schema, SchemaTransformation } from "effect"
const schema = Schema.Trim.pipe(
Schema.decodeTo(Schema.FiniteFromString, SchemaTransformation.passthrough())
)export function function passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E> (+1 overload)
Transforms values by returning the input unchanged in both
directions.
When to use
Use when you need a schema transformation to connect two schemas that share
the same type with no actual conversion.
Details
- Both decode and encode are no-ops.
- Returns a shared singleton instance (no allocation per call).
- By default,
T and E must be the same type. Pass { strict: false }
to bypass the type constraint.
Example (Chaining schemas with no conversion)
import { Schema, SchemaTransformation } from "effect"
const schema = Schema.Trim.pipe(
Schema.decodeTo(Schema.FiniteFromString, SchemaTransformation.passthrough())
)
passthrough<function (type parameter) T in passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E>
T, function (type parameter) E in passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E>
E>(options: {
readonly strict: false
}
options: { readonly strict: falsestrict: false }): class Transformation<in out T, in out E, RD = never, RE = never>class Transformation {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => Transformation<E, T, RE, RD>;
compose: <T2, RD2, RE2>(other: Transformation<T2, T, RD2, RE2>) => Transformation<T2, E, RD | RD2, RE | RE2>;
}
Represents a bidirectional transformation between a decoded type T and an encoded
type E, built from a pair of Getters.
When to use
Use when you need a schema transformation that defines how a schema converts
between two representations.
- You want to compose multiple transformations into a pipeline.
- You want to flip a transformation to swap decode/encode.
Details
This is the primary building block for Schema.decodeTo, Schema.encodeTo,
Schema.decode, Schema.encode, and Schema.link. Each direction is a
SchemaGetter.Getter that handles optionality, failure, and Effect services.
- Immutable —
flip() and compose() return new instances.
flip() swaps the decode and encode getters.
compose(other) chains: this.decode then other.decode for decoding,
other.encode then this.encode for encoding.
Example (Composing two transformations)
import { SchemaTransformation } from "effect"
const trimAndLower = SchemaTransformation.trim().compose(
SchemaTransformation.toLowerCase()
)
// decode: trim then lowercase
// encode: passthrough (both directions)
Transformation<function (type parameter) T in passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E>
T, function (type parameter) E in passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E>
E>
export function function passthrough<T>(): Transformation<T, T> (+1 overload)Transforms values by returning the input unchanged in both
directions.
When to use
Use when you need a schema transformation to connect two schemas that share
the same type with no actual conversion.
Details
- Both decode and encode are no-ops.
- Returns a shared singleton instance (no allocation per call).
- By default,
T and E must be the same type. Pass { strict: false }
to bypass the type constraint.
Example (Chaining schemas with no conversion)
import { Schema, SchemaTransformation } from "effect"
const schema = Schema.Trim.pipe(
Schema.decodeTo(Schema.FiniteFromString, SchemaTransformation.passthrough())
)
passthrough<function (type parameter) T in passthrough<T>(): Transformation<T, T>T>(): class Transformation<in out T, in out E, RD = never, RE = never>class Transformation {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => Transformation<E, T, RE, RD>;
compose: <T2, RD2, RE2>(other: Transformation<T2, T, RD2, RE2>) => Transformation<T2, E, RD | RD2, RE | RE2>;
}
Represents a bidirectional transformation between a decoded type T and an encoded
type E, built from a pair of Getters.
When to use
Use when you need a schema transformation that defines how a schema converts
between two representations.
- You want to compose multiple transformations into a pipeline.
- You want to flip a transformation to swap decode/encode.
Details
This is the primary building block for Schema.decodeTo, Schema.encodeTo,
Schema.decode, Schema.encode, and Schema.link. Each direction is a
SchemaGetter.Getter that handles optionality, failure, and Effect services.
- Immutable —
flip() and compose() return new instances.
flip() swaps the decode and encode getters.
compose(other) chains: this.decode then other.decode for decoding,
other.encode then this.encode for encoding.
Example (Composing two transformations)
import { SchemaTransformation } from "effect"
const trimAndLower = SchemaTransformation.trim().compose(
SchemaTransformation.toLowerCase()
)
// decode: trim then lowercase
// encode: passthrough (both directions)
Transformation<function (type parameter) T in passthrough<T>(): Transformation<T, T>T, function (type parameter) T in passthrough<T>(): Transformation<T, T>T>
export function function passthrough<T, E>(options: {
readonly strict: false;
}): Transformation<T, E> (+1 overload)
Transforms values by returning the input unchanged in both
directions.
When to use
Use when you need a schema transformation to connect two schemas that share
the same type with no actual conversion.
Details
- Both decode and encode are no-ops.
- Returns a shared singleton instance (no allocation per call).
- By default,
T and E must be the same type. Pass { strict: false }
to bypass the type constraint.
Example (Chaining schemas with no conversion)
import { Schema, SchemaTransformation } from "effect"
const schema = Schema.Trim.pipe(
Schema.decodeTo(Schema.FiniteFromString, SchemaTransformation.passthrough())
)
passthrough<function (type parameter) T in passthrough<T>(): Transformation<T, T>T>(): class Transformation<in out T, in out E, RD = never, RE = never>class Transformation {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => Transformation<E, T, RE, RD>;
compose: <T2, RD2, RE2>(other: Transformation<T2, T, RD2, RE2>) => Transformation<T2, E, RD | RD2, RE | RE2>;
}
Represents a bidirectional transformation between a decoded type T and an encoded
type E, built from a pair of Getters.
When to use
Use when you need a schema transformation that defines how a schema converts
between two representations.
- You want to compose multiple transformations into a pipeline.
- You want to flip a transformation to swap decode/encode.
Details
This is the primary building block for Schema.decodeTo, Schema.encodeTo,
Schema.decode, Schema.encode, and Schema.link. Each direction is a
SchemaGetter.Getter that handles optionality, failure, and Effect services.
- Immutable —
flip() and compose() return new instances.
flip() swaps the decode and encode getters.
compose(other) chains: this.decode then other.decode for decoding,
other.encode then this.encode for encoding.
Example (Composing two transformations)
import { SchemaTransformation } from "effect"
const trimAndLower = SchemaTransformation.trim().compose(
SchemaTransformation.toLowerCase()
)
// decode: trim then lowercase
// encode: passthrough (both directions)
Transformation<function (type parameter) T in passthrough<T>(): Transformation<T, T>T, function (type parameter) T in passthrough<T>(): Transformation<T, T>T> {
return const passthrough_: Transformation<
any,
any,
never,
never
>
const passthrough_: {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => Transformation<any, any, never, never>;
compose: (other: Transformation<T2, any, RD2, RE2>) => Transformation<T2, any, RD2, RE2>;
}
passthrough_
}