Skip to content

isResultOk

Returns true for successful Result tuple

260 bytes

Usage

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

declare const value: unknown
if (isResultOk(value)) {
value // <-- now an Ok<unknown> type
value[1] // <-- This is the resulting value!
}

Also see the related isResult and isResultErr functions.