| 2150 | * @since 4.0.0 |
| 2151 | */ |
| 2152 | export function encodeUnknownResult<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) { |
| 2153 | const parser = SchemaParser.encodeUnknownResult(schema, options) |
| 2154 | return (input: unknown, options?: SchemaAST.ParseOptions): Result_.Result<S["Encoded"], SchemaError> => { |
| 2155 | return Result_.mapError(parser(input, options), (issue) => new SchemaError(issue)) |
| 2156 | } |
| 2157 | } |
| 2158 | /** |
| 2159 | * Encodes a typed input (the schema's `Type`) against a schema, returning a |
| 2160 | * `Result` that succeeds with the encoded value or fails with a |