Skip to content

isRight

isRight<R>(x): x is Right<R>

Check whether given x is of type Right.

Example

isRight({right: 123})
// => true
isRight({left: 456})
// => false
isRight({right: "foobar"} as Either<number, string>)
// => x is Right<string>

Type Parameters

R

The Right type.

Parameters

x

unknown

The value to check.

Returns

x is Right<R>

true if x is a Right, false otherwise.