Skip to content

unwrapRight ​

Unwraps the payload of a Right and returns the input unchanged when the input is not Right.

Interactive example ​

Syntax ​

typescript
function unwrapRight<
  GenericInput extends unknown
>(
  input: GenericInput
): GenericInput extends Right
  ? Unwrap<GenericInput>
  : GenericInput

Parameters ​

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

Return value ​

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

See also ​

Released under the MIT license.