effect-io-ai

Package: effect
Module: SchemaParser

SchemaParser.decodeUnknownPromise

Creates a Promise-based decoder for unknown input.

When to use

Use when you need to decode untyped input with a service-free schema and return a JavaScript Promise.

Details

The returned function resolves with the decoded Type on success and rejects with an Error whose cause is a SchemaIssue.Issue on decoding failure.

Gotchas

Causes that contain defects, interruptions, or other non-schema reasons reject with an Error whose cause is the underlying Cause.

See

Signature

declare const decodeUnknownPromise: <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]>

Source

Since v3.10.0