property Failure.hasCode

Narrows to a specific set of codes, for handling some failures and rethrowing the rest.

Type

<Codes extends readonly string[]>(
value: unknown,
...codes: Codes
) => value is AnyFailure & { code: Codes[number]; }

Usage

import { Failure } from "lib/api/index.ts";