(target: Schema.Constraint, trusted: Trusted)
| 5492 | // reporting them, so other success exits keep the schema pass. It is not a |
| 5493 | // sound `Schema.is` guard, which is why only {@link toCodecDirect} uses it. |
| 5494 | function withExitSuccessDecode(target: Schema.Constraint, trusted: Trusted): Schema.Constraint { |
| 5495 | return Schema.declareConstructor<unknown>()( |
| 5496 | [target], |
| 5497 | ([codec]) => { |
| 5498 | const parse = SchemaParser.decodeUnknownEffect(codec as Schema.ConstraintDecoder<unknown>) |
| 5499 | return (input, _ast, options) => |
| 5500 | takeTrusted(trusted, input) || |
| 5501 | (isSuccessExit(input) && options.onExcessProperty !== "error") |
| 5502 | ? Effect.succeed(input) |
| 5503 | : parse(input, options) |
| 5504 | }, |
| 5505 | { identifier: "binary exit value" } |
| 5506 | ) |
| 5507 | } |
| 5508 | |
| 5509 | // An exact schema is fully validated by the binary layer in both directions, so |
| 5510 | // this target adds nothing, except under `onExcessProperty: "error"`. |
no test coverage detected