Hyperlinkv0.8.0-beta.28

SchemaParser

SchemaParser.decodeExitconsteffect/SchemaParser.ts:426
<S extends Schema.ConstraintDecoder<unknown>>(
  schema: S,
  options?: SchemaAST.ParseOptions
): (
  input: S["Encoded"],
  options?: SchemaAST.ParseOptions
) => Exit.Exit<S["Type"], SchemaIssue.Issue>

Creates a synchronous decoder for input already typed as the schema's Encoded type, reporting failure safely as an Exit.

When to use

Use when you need synchronous decoding of already typed Encoded input into an Exit whose failure contains SchemaIssue.Issue.

Details

The returned function produces Exit.Success with the decoded Type or Exit.Failure with a SchemaIssue.Issue.

Gotchas

Because this adapter runs synchronously, async decoding work can produce an Exit.Failure with a defect cause. When the cause contains both schema issues and non-schema reasons, all reasons remain in the returned Cause.

export const decodeExit: <S extends Schema.ConstraintDecoder<unknown>>(
  schema: S,
  options?: SchemaAST.ParseOptions
) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue> =
  decodeUnknownExit