Package: effect
Module: SchemaParser
Creates a synchronous decoder for unknown input.
When to use
Use to decode untrusted or dynamically typed input at a synchronous boundary
where invalid data should throw an Error whose cause is SchemaIssue.Issue.
Details
The returned function returns the decoded Type on success and throws an
Error with the SchemaIssue.Issue in its cause on decoding failure.
Gotchas
Causes that contain defects, interruptions, or asynchronous work at this
synchronous boundary throw an Error whose cause is the underlying Cause,
instead of being converted to a schema validation error.
See
decodeSync for input already typed as the schema’s Encoded typedecodeUnknownEffect for preserving decoding failures in EffectdecodeUnknownResult for returning schema issues as dataSignature
declare const decodeUnknownSync: <S extends Schema.ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"]
Since v3.10.0