MCPcopy Create free account
hub / github.com/effect-app/libs / transformTo

Function transformTo

packages/effect-app/src/Schema/ext.ts:554–576  ·  view source on GitHub ↗
(
  from: From,
  to: To,
  decode: (
    fromA: From["Type"],
    options: SchemaAST.ParseOptions
  ) => To["Encoded"]
)

Source from the content-addressed store, hash-verified

552 readonly "~type.constructor.default": "no-default"
553 readonly "Rebuild": DropConstructorDefault<T>
554 annotate(annotations: S.Annotations.Bottom<T["Type"], T["~type.parameters"]>): DropConstructorDefault<T>
555 annotateKey(annotations: S.Annotations.Key<T["Type"]>): DropConstructorDefault<T>
556 check(
557 ...checks: readonly [SchemaAST.Check<T["Type"]>, ...Array<SchemaAST.Check<T["Type"]>>]
558 ): DropConstructorDefault<T>
559 rebuild(ast: T["ast"]): DropConstructorDefault<T>
560 }
561
562// `replaceContext` is `@internal` in `effect/SchemaAST` (stripped from its public types, though the
563// export itself still ships in the compiled JS). Effect's own `withConstructorDefault` goes through the
564// same function internally, so this mirrors an existing code path rather than reaching for something
565// novel, but it's still an internal API that could move or disappear without a signal.
566const SchemaASTInternal = SchemaAST as unknown as {
567 readonly replaceContext: <A extends SchemaAST.AST>(ast: A, context: SchemaAST.Context | undefined) => A
568}
569
570export interface DropConstructorDefaultLambda extends Struct.Lambda {
571 <T extends S.Top>(self: T): DropConstructorDefault<T>
572 readonly "~lambda.out": DropConstructorDefault<this["~lambda.in"] & S.Top>
573}
574
575/**
576 * A `Struct.Lambda` that removes a field's `withConstructorDefault`, if any.
577 * Compose with `Struct.pick`/`Struct.omit` via `Struct.map` to derive a
578 * partial-update schema from a "create" schema without inheriting defaults
579 * that would resurrect omitted fields in `.make(...)` output:

Callers

nothing calls this directly

Calls 5

syncMethod · 0.80
someMethod · 0.80
pipeMethod · 0.65
decodeFunction · 0.50
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…