| 2174 | * @since 4.0.0 |
| 2175 | */ |
| 2176 | export function encodeUnknownResult<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) { |
| 2177 | const parser = SchemaParser.encodeUnknownResult(schema, options) |
| 2178 | return (input: unknown, options?: SchemaAST.ParseOptions): Result_.Result<S["Encoded"], SchemaError> => { |
| 2179 | return Result_.mapError(parser(input, options), (issue) => new SchemaError(issue)) |
| 2180 | } |
| 2181 | } |
| 2182 | |
| 2183 | /** |
| 2184 | * Encodes a typed input (the schema's `Type`) against a schema, returning a |