interface Failure.FailureFactory

A callable failure constructor produced by define(), carrying its own type guard.

Type Parameters

Code extends string
Data

Call Signatures

(
data: Data,
options?: FailureOptions
): Failure<Code, Data>

Properties

readonly
code: Code

The literal code this factory produces. Useful as a switch case and in registries.

Methods

is(value: unknown): value is Failure<Code, Data>

Cross-realm type guard narrowing to this exact failure — the flat rethrow line's guard after a Result.try.

Usage

import { type Failure } from "lib/stream/index.ts";
type { FailureFactory } = Failure;