Skip to content

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>
  : GenericInput

Parameters ​

  • input: Value to unwrap when it is a Left.

Return value ​

Returns the unwrapped payload for Left, otherwise returns input unchanged.

See also ​

Released under the MIT license.