/** * Narrow, dependency-free helpers for the `Result` discriminated * union. Import when you prefer fluent semantics over discriminating * `{ data, error }` by hand. * * @module */ import type { EmailError, Result } from "../types.mjs"; export declare function isOk(r: Result): r is { data: T; error: null; }; export declare function isErr(r: Result): r is { data: null; error: EmailError; }; /** Return `data` or throw the `error`. Intentionally dramatic — only * use when you're sure the caller wants a throw. */ export declare function unwrap(r: Result): T; /** Return `data` if Ok, `fallback` otherwise. */ export declare function unwrapOr(r: Result, fallback: T): T; /** Apply `f` to `data` if Ok; pass through the Err unchanged. */ export declare function mapOk< T, U >(r: Result, f: (t: T) => U): Result; /** Transform the `error` while preserving Ok. */ export declare function mapErr(r: Result, f: (e: EmailError) => EmailError): Result; /** Run `f` and capture any thrown `EmailError` into a `Result`. Any * non-EmailError exception re-throws. */ export declare function tryAsync(f: () => Promise, wrap: (err: unknown) => EmailError): Promise>;