Hyperlinkv0.8.0-beta.28

SchemaGetter

SchemaGetter.passthroughSubtypefunctioneffect/SchemaGetter.ts:298
<T, E extends T>(): Getter<T, E>

Returns the identity getter, typed for when the encoded type E is a subtype of T.

When to use

Use when you need a schema getter that passes values through without { strict: false } for an encoded type that narrows the decoded type.

Details

  • Same singleton as passthrough — no allocation, optimized in composition.

Example (Passing through subtypes)

import { SchemaGetter } from "effect"

// "hello" extends string, so E extends T
const g = SchemaGetter.passthroughSubtype<string, "hello">()
export function passthroughSubtype<T, E extends T>(): Getter<T, E>
export function passthroughSubtype<T>(): Getter<T, T> {
  return passthrough_
}