/** * Result Type Implementation * * Implements the Result pattern for explicit error handling. * Follows guardrails.md requirements for functional error handling. * Part of Layer 3 (Business Logic & Execution) */ /** * Successful result variant */ export interface Ok { readonly ok: true; readonly value: T; } /** * Error result variant */ export interface Err { readonly ok: false; readonly error: E; } /** * Result type for explicit error handling * Use this instead of throwing exceptions for expected errors */ export type Result = Ok | Err; /** * Create a successful result * @param value - The success value * @returns Ok result */ export declare function ok(value: T): Ok; /** * Create an error result * @param error - The error value * @returns Err result */ export declare function err(error: E): Err; /** * Type guard to check if result is Ok * @param result - The result to check * @returns true if result is Ok */ export declare function isOk(result: Result): result is Ok; /** * Type guard to check if result is Err * @param result - The result to check * @returns true if result is Err */ export declare function isErr(result: Result): result is Err; /** * Unwrap a result, returning the value or throwing the error * @param result - The result to unwrap * @returns The value if Ok * @throws The error if Err */ export declare function unwrap(result: Result): T; /** * Unwrap a result with a default value * @param result - The result to unwrap * @param defaultValue - Value to return if Err * @returns The value if Ok, defaultValue if Err */ export declare function unwrapOr(result: Result, defaultValue: T): T; /** * Map the success value of a result * @param result - The result to map * @param fn - Function to transform the value * @returns New result with transformed value */ export declare function map(result: Result, fn: (value: T) => U): Result; /** * Map the error value of a result * @param result - The result to map * @param fn - Function to transform the error * @returns New result with transformed error */ export declare function mapErr(result: Result, fn: (error: E) => F): Result; /** * Flat map (chain) operations on results * @param result - The result to flatMap * @param fn - Function returning a Result * @returns Flattened Result */ export declare function flatMap(result: Result, fn: (value: T) => Result): Result; //# sourceMappingURL=result.d.ts.map