unwrapLeft
Unwraps the payload of a Left and returns the input unchanged when the input is not Left.
Interactive example
Syntax
typescript
function unwrapLeft<
GenericInput extends unknown
>(
input: GenericInput
): GenericInput extends Left
? Unwrap<GenericInput>
: GenericInputParameters
input: Value to unwrap when it is aLeft.
Return value
Returns the unwrapped payload for Left, otherwise returns input unchanged.
See also
unwrapLeftOrThrow– Throwing variant when input is notLeft.isLeft– Type guard to check left side.unwrapByInformation– Information-based non-throwing unwrap.
