({ left, right }: {
readonly left: L
readonly right: R
})
| 7482 | * @since 3.10.0 |
| 7483 | */ |
| 7484 | export const Either = <R extends Schema.All, L extends Schema.All>({ left, right }: { |
| 7485 | readonly left: L |
| 7486 | readonly right: R |
| 7487 | }): Either<R, L> => { |
| 7488 | const right_ = asSchema(right) |
| 7489 | const left_ = asSchema(left) |
| 7490 | const out = transform( |
| 7491 | eitherEncoded(right_, left_), |
| 7492 | EitherFromSelf({ left: typeSchema(left_), right: typeSchema(right_) }), |
| 7493 | { |
| 7494 | strict: true, |
| 7495 | decode: (i) => eitherDecode(i), |
| 7496 | encode: (a) => |
| 7497 | either_.match(a, { |
| 7498 | onLeft: makeLeftEncoded, |
| 7499 | onRight: makeRightEncoded |
| 7500 | }) |
| 7501 | } |
| 7502 | ) |
| 7503 | return out as any |
| 7504 | } |
| 7505 | |
| 7506 | /** |
| 7507 | * @category api interface |
nothing calls this directly
no test coverage detected