import { type Kind, type WrappedValue, type Unwrap, type BreakGenericLink } from "../common"; import { type Right } from "./right"; import { type Left } from "./left"; import { informationKind } from "./kind"; type Either = Right | Left; /** * Functional pattern matching based on the literal information of an Either. The function is executed only when the information (or one of the informations) matches. * * **Supported call styles:** * - Classic: `whenHasInformation(input, information, theFunction)` → returns a value * - Curried: `whenHasInformation(information, theFunction)` → returns a function waiting for the input * * If the condition matches, the callback runs; otherwise the original value is returned. * * ```ts * const input = true * ? false * ? E.right("right-1", 1) * : E.left("left-2", 2) * : E.left("left-3", 3); * * const result = pipe( * input, * E.whenHasInformation("right-1", (value) => { * // type: 1 * return value; * }), * E.whenHasInformation("left-2", (value) => { * // type: 2 * return value; * }), * ); * * // type: 1 | 2 | E.Left<"left-3", 3> * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/whenHasInformation * * @namespace E * */ export declare function whenHasInformation> : never), const GenericOutput extends unknown>(information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap, Kind & WrappedValue>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude, Kind>; export declare function whenHasInformation> : never), const GenericOutput extends unknown>(input: GenericInput, information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap, Kind & WrappedValue>>) => GenericOutput): GenericOutput | Exclude>; export {};