Clarification on Schema Type Naming in Effect Typescript Library

Does anyone know why the Schema Type Schema<Type, Encoded, Requirements> is used over something like Schema<Decoded, Encoded, Requirements>?

The Type keyword made Schema much harder to understand initially because my overloaded understanding of Type implied that a schema is the thing, not a directional description.

I had to alias Type to Decoded in my head for it to finally make sense. In addition to convert all my schemas using Schema.asSchema to get them into a consistent type hint format (similar to effect and layers) - now i can build my schemas as blocks using the types similar to effect.

Schema<Decoded, Encoded, Requirements>

decoding a schema means you are going from a type of Encoded to a type of Decoded. encoding a schema means you are going from a type of Decoded to a type of Encoded.

After understanding this, it was so much easier to build on and know how transforms and composing works.

The terminology in the docs even correctly describes decoded but then decides to call it Type.
image.png
Was this page helpful?