Skip to content

isResultErr

Returns true for failed Result tuple

261 bytes

Usage

Check if a value is both a Result tuple and an Err result.

declare const value: unknown
if (isResultErr(value)) {
value // <-- now an Err<Error> type
value[0] // <-- This is the error!
}

Also see the related isResult and isResultOk functions.