Skip to content

Function: isErrResult()

isErrResult(value): value is Err<any>

Defined in: index.ts:351

Type guard that checks if an unknown value is an Err result. Unlike isErr, this accepts any unknown value and checks if it's a valid Err result.

Parameters

value

unknown

The value to check

Returns

value is Err<any>

True if the value is an Err result, false otherwise

Example

typescript
if (isErrResult(value)) {
  // value is now typed as Err
  console.log(value.error);
}