Hyperlinkv0.8.0-beta.28

SchemaParser

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

Creates a synchronous decoder for unknown input that reports failure safely as an Exit.

When to use

Use when you need to decode unknown input synchronously into an Exit whose failure contains SchemaIssue.Issue.

Details

The returned function produces Exit.Success with the decoded Type. Schema issues are represented by an Exit.Failure cause containing 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 function decodeUnknownExit<S extends Schema.ConstraintDecoder<unknown>>(
  schema: S,
  options?: SchemaAST.ParseOptions
): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue> {
  return asExit(decodeUnknownEffect(schema, options))
}
Referenced by 2 symbols