Package: effect
Module: Schema
Decodes an unknown input against a schema, returning a Promise that
resolves with the decoded value or rejects with a SchemaError for
schema mismatches.
When to use
Use when you need decoding of unknown input to return a JavaScript Promise
that rejects with SchemaError for schema mismatches.
Details
For input already typed as the schema’s Encoded type use
decodePromise.
Options may be provided either when creating the decoder or when applying it;
application options override creation options.
Gotchas
Non-schema failures may reject with a runtime failure instead of
SchemaError.
See
SchemaParser.decodeUnknownPromise for the adapter that rejects with an Error whose cause is SchemaIssue.IssueSignature
declare const decodeUnknownPromise: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]>
Since v3.10.0