import type { NeonErrorUnion } from "./errors.js"; /** * The uniform result envelope returned by every ergonomic call when `throwOnError` is * off (the default). A discriminated union: when `error` is set, `data` is `undefined`, * and vice versa. `error` is {@link NeonErrorUnion} — discriminate on `error.kind`. */ export type NeonResult = { data: T; error: undefined; } | { data: undefined; error: NeonErrorUnion; }; /** * The return type of a method, conditioned on whether errors are thrown. With * `throwOnError`, the method resolves to the bare `T` (and throws on failure); otherwise * it resolves to {@link NeonResult}. */ export type Outcome = Throw extends true ? T : NeonResult; export declare function ok(data: T): NeonResult; export declare function err(error: NeonErrorUnion): NeonResult; /** * Apply the `throwOnError` policy to a result: return the bare value (throwing on error) * when `shouldThrow`, otherwise return the {@link NeonResult} envelope. */ export declare function finalize(result: NeonResult, shouldThrow: boolean): T | NeonResult; //# sourceMappingURL=result.d.ts.map