/** * A value representing either a successful outcome or an error. * * `Result` is used in APIs when you want to make explicit flow control * decisions about success/failure rather than allowing them to * automatically percolate. * * A successful result has the shape `{ ok: true, value }` and a failed result * has the shape `{ ok: false, error }`. * * @since 4.1 */ export type Result = { readonly ok: true; value: T; } | { readonly ok: false; error: Error; }; /** * Construct a successful {@link Result}. * * ### Example * * ```javascript * import { Ok } from 'effection'; * * let result = Ok("hello"); * // { ok: true, value: "hello" } * ``` * * @since 4.1 */ export declare function Ok(): Result; export declare function Ok(value: T): Result; /** * Construct a failed {@link Result}. * * ### Example * * ```javascript * import { Err } from 'effection'; * * let result = Err(new Error("oh no")); * // { ok: false, error: Error("oh no") } * ``` * * @since 4.1 */ export declare function Err(cause: unknown): Result; /** * @ignore */ export declare function unbox(result: Result): T;