import { type GetKindValue, type Kind, type Unwrap } from "../common"; import { type ForbiddenKey, type GetPropsWithValue } from "../object"; import { informationKind } from "./kind"; import { type Left } from "./left"; import { type Right } from "./right"; type Either = Right | Left; type ForbiddenMoreKey> = ForbiddenKey>>, string>>; type SelectedKind> = Kind, string>>; type CallbackSelectedKind> = Kind | GetPropsWithValue, string>>; /** * Runs one callback for selected Either informations and an otherwise callback for every unselected raw input. * * **Supported call styles:** * - Classic: `whenIsSelectedOtherwise(input, selector, theFunction, otherwiseFunction)` → returns a callback result * - Curried: `whenIsSelectedOtherwise(selector, theFunction, otherwiseFunction)` → returns a function waiting for the input * * The matching callback keeps the same unwrapped-value contract as the corresponding `when` function. The otherwise callback receives the original raw input, excluding only inputs known to match the condition. * * ```ts * const selector = { * success: true, * failure: false, * } as const; * * const matched = E.whenIsSelectedOtherwise( * true * ? E.right("success", 42) * : E.left("failure", "error"), * selector, * (value) => value, * () => 0, * ); // 42 * * const fallback = E.whenIsSelectedOtherwise( * false * ? E.right("success", 42) * : E.left("failure", "error"), * selector, * (value) => value, * (value) => value, * ); // E.Left<"failure", "error"> * * const piped = pipe( * true * ? E.right("success", 42) * : E.left("failure", "error"), * E.whenIsSelectedOtherwise( * selector, * (value) => value, * () => 0, * ), * ); // 42 * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/whenIsSelectedOtherwise * * @namespace E * */ export declare function whenIsSelectedOtherwise>, boolean>, const GenericOutput extends unknown, const GenericOtherwiseOutput extends unknown>(selector: GenericSelector & ForbiddenMoreKey, theFunction: (value: Unwrap>>) => GenericOutput, otherwiseFunction: (value: Exclude>) => GenericOtherwiseOutput): (input: GenericInput) => GenericOutput | GenericOtherwiseOutput; export declare function whenIsSelectedOtherwise>, boolean>, const GenericOutput extends unknown, const GenericOtherwiseOutput extends unknown>(input: GenericInput, selector: GenericSelector & ForbiddenMoreKey, theFunction: (value: Unwrap>>) => GenericOutput, otherwiseFunction: (value: Exclude>) => GenericOtherwiseOutput): GenericOutput | GenericOtherwiseOutput; export {};