Decoder<T, RD>A schema that tracks the decoded type T and the Effect services required
during decoding (RD).
When to use
Use when you need to preserve a schema's decoded type and decoding service requirements, but do not need to constrain its encoded representation or encoding services.
export interface interface Decoder<out T, out RD = never>A schema that tracks the decoded type T and the Effect services required
during decoding (RD).
When to use
Use when you need to preserve a schema's decoded type and decoding service
requirements, but do not need to constrain its encoded representation or
encoding services.
Decoder<out function (type parameter) T in Decoder<out T, out RD = never>T, out function (type parameter) RD in Decoder<out T, out RD = never>RD = 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<function (type parameter) T in Decoder<out T, out RD = never>T> {
readonly "Encoded": unknown
readonly "DecodingServices": function (type parameter) RD in Decoder<out T, out RD = never>RD
readonly "EncodingServices": unknown
readonly "Rebuild": interface Decoder<out T, out RD = never>A schema that tracks the decoded type T and the Effect services required
during decoding (RD).
When to use
Use when you need to preserve a schema's decoded type and decoding service
requirements, but do not need to constrain its encoded representation or
encoding services.
Decoder<function (type parameter) T in Decoder<out T, out RD = never>T, function (type parameter) RD in Decoder<out T, out RD = never>RD>
}