Hyperlinkv0.8.0-beta.28

SchemaGetter

SchemaGetter.passthroughSupertypefunctioneffect/SchemaGetter.ts:266
<T extends E, E>(): Getter<T, E>

Returns the identity getter typed for the relationship T extends E.

When to use

Use when you need a schema getter that passes values through when the decoded/output type is narrower than the encoded/input type.

Details

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

Example (Passing through supertypes)

import { SchemaGetter } from "effect"

// string extends string, so this is valid
const g = SchemaGetter.passthroughSupertype<string, string>()
export function passthroughSupertype<T extends E, E>(): Getter<T, E>
export function passthroughSupertype<T>(): Getter<T, T> {
  return passthrough_
}