import { type Left } from "../left"; import { type Right } from "../right"; import { type FutureSuccess } from "./success"; import { type FutureError } from "./error"; import { type IsEqual } from "../../common/types/isEqual"; import { type AnyValue } from "../../common"; type Either = Right | Left; type ComputeEitherFutureSuccessResult = IsEqual> extends false ? FutureSuccess> : never; type ComputeEitherFutureErrorResult = GenericValue extends Future ? GenericValue : GenericValue extends Promise ? FutureError : never; type ComputeFutureEitherResult = Extract<(Extract, Either> | ComputeEitherFutureSuccessResult> | ComputeEitherFutureErrorResult), any>; export type FutureEitherAllResult = Future<{ -readonly [Prop in keyof GenericArray]: Awaited>; }>; declare const kind = "kind-future-either"; export declare class Future extends Promise, any>> { constructor(value: GenericValue); [kind]: unknown; then, any>, TResult2 = never>(onfulfilled?: ((value: Extract, any>) => TResult1 | PromiseLike) | null): Promise; static get [Symbol.species](): PromiseConstructor; static instanceof(value: GenericValue): value is Extract>; static rightAll(values: GenericArray): FutureEitherAllResult; } /** * Future class: an enhanced promise capable of carrying Either values and exposing helpers like Future.all. * * Signature: `future(value)` → returns a value * * The input value is not mutated. * * ```ts * const maybePromise = E.future( * Promise.resolve(1), * ); * * await maybePromise.then((value) => { * // type: E.FutureSuccess | E.FutureError * return value; * }); * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/future * * @namespace E * */ export declare function future(value: GenericEither): Future; export {};