Encoder<E, RE>A schema that tracks the encoded type E and the Effect services required
during encoding (RE).
When to use
Use when you need to preserve a schema's encoded type and encoding service requirements, but do not need to constrain its decoded representation or decoding services.
export interface interface Encoder<out E, out RE = never>A schema that tracks the encoded type E and the Effect services required
during encoding (RE).
When to use
Use when you need to preserve a schema's encoded type and encoding service
requirements, but do not need to constrain its decoded representation or
decoding services.
Encoder<out function (type parameter) E in Encoder<out E, out RE = never>E, out function (type parameter) RE in Encoder<out E, out RE = never>RE = never> extends interface Schema<out T>Namespace of type-level helpers for
Schema
.
A typed view of a schema that tracks only the decoded (output) type T.
Details
Use Schema<T> as a constraint when you want to accept "any schema that
decodes to T" and do not need to know or constrain the encoded
representation, required services, or any other type parameters.
This is a structural interface — concrete schema values are produced by the
constructors in this module (e.g.
Struct
,
String
,
Number
).
When you also need the encoded type or service requirements, use
Codec
.
Example (Accepting any schema decoding to string)
import { Schema } from "effect"
declare function print(schema: Schema.Schema<string>): void
print(Schema.String) // ok
print(Schema.NonEmptyString) // ok
Schema<unknown> {
readonly "Encoded": function (type parameter) E in Encoder<out E, out RE = never>E
readonly "DecodingServices": unknown
readonly "EncodingServices": function (type parameter) RE in Encoder<out E, out RE = never>RE
readonly "Rebuild": interface Encoder<out E, out RE = never>A schema that tracks the encoded type E and the Effect services required
during encoding (RE).
When to use
Use when you need to preserve a schema's encoded type and encoding service
requirements, but do not need to constrain its decoded representation or
decoding services.
Encoder<function (type parameter) E in Encoder<out E, out RE = never>E, function (type parameter) RE in Encoder<out E, out RE = never>RE>
}