MCPcopy Create free account
hub / github.com/Effect-TS/effect / transformOrFail

Function transformOrFail

packages/effect/src/SchemaTransformation.ts:286–294  ·  view source on GitHub ↗
(options: {
  readonly decode: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, RD>
  readonly encode: (t: T, options: SchemaAST.ParseOptions) => Effect.Effect<E, SchemaIssue.Issue, RE>
})

Source from the content-addressed store, hash-verified

284 * @since 3.10.0
285 */
286export function transformOrFail<T, E, RD = never, RE = never>(options: {
287 readonly decode: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, RD>
288 readonly encode: (t: T, options: SchemaAST.ParseOptions) => Effect.Effect<E, SchemaIssue.Issue, RE>
289}): Transformation<T, E, RD, RE> {
290 return new Transformation(
291 SchemaGetter.transformOrFail(options.decode),
292 SchemaGetter.transformOrFail(options.encode)
293 )
294}
295
296/**
297 * Creates a `Transformation` from pure (sync, infallible) decode and encode

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected