Hyperlinkv0.8.0-beta.28

SchemaParser

SchemaParser.decodeUnknownEffectfunctioneffect/SchemaParser.ts:258
<S extends Schema.Constraint>(
  schema: S,
  options?: SchemaAST.ParseOptions
): (
  input: unknown,
  options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]>

Creates an effectful decoder for unknown input.

When to use

Use when you need to decode untyped boundary input in an Effect whose failure channel is SchemaIssue.Issue, while preserving transformations and service requirements.

Details

The returned function succeeds with the schema's decoded Type or fails with a SchemaIssue.Issue. Decoding service requirements are preserved in the returned Effect. Parse options may be provided when creating the decoder and overridden when applying it.

decodingdecodeEffect
export function decodeUnknownEffect<S extends Schema.Constraint>(
  schema: S,
  options?: SchemaAST.ParseOptions
): (
  input: unknown,
  options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]> {
  const parser = run<S["Type"], S["DecodingServices"]>(schema.ast)
  return options === undefined
    ? parser
    : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions))
}
Referenced by 18 symbols