unwrapRightOrThrow
Unwraps the payload of a Right and throws a NotRightError when the input is not Right.
Interactive example
Syntax
typescript
function unwrapRightOrThrow<
GenericInput extends unknown
>(
input: GenericInput
): Unwrap<Extract<GenericInput, Right>>Parameters
input: Value expected to be aRight.
Return value
Returns the unwrapped payload when the input is Right. Otherwise, the function throws E.NotRightError.
See also
isRight– Type guard to check the input before unwrapping.right– GenericRightconstructor.unwrapByInformationOrThrow– Variant that also checks the literal information.
