unwrapLeftOrThrow
Unwraps the payload of a Left and throws a NotLeftError when the input is not Left.
Interactive example
Syntax
typescript
function unwrapLeftOrThrow<
GenericInput extends unknown
>(
input: GenericInput
): Unwrap<Extract<GenericInput, Left>>Parameters
input: Value expected to be aLeft.
Return value
Returns the unwrapped payload when the input is Left. Otherwise, the function throws E.NotLeftError.
See also
isLeft– Type guard to check the input before unwrapping.left– GenericLeftconstructor.unwrapByInformationOrThrow– Variant that targets one precise information.
