import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common"; import { type Kind } from "../../common/kind"; import { boolKind } from "./base"; import { type Left } from "../left"; import { type Right } from "../right"; import { bool } from "./create"; export declare const boolTruthyKind: import("../../common").KindHandler>; /** * @deprecated use boolTruthyKind */ export declare const eitherBoolTruthyKind: import("../../common").KindHandler>; type _BoolTruthy = (Right<"bool", GenericValue> & Kind & Kind); export interface BoolTruthy extends _BoolTruthy { } /** * @deprecated use BoolTruthy */ export type EitherBoolTruthy = BoolTruthy; /** * Forces the creation of an Right<"bool"> by explicitly marking a truthy value. * * Signature: `boolTruthy(value)` → returns a value * * The input value is not mutated. * * ```ts * const input = "hello@duplo.dev" as string; * * const result = pipe( * input, * when( * S.includes("@"), * E.boolTruthy, * ), * ); * * // type: string | E.BoolTruthy<`${string}@${string}`> * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/boolTruthy * * @namespace E * */ /** * Type guard that checks whether an Either from the boolean helpers is truthy. * * Signature: `isBoolTruthy(input)` → returns a value * * Acts as a type guard and narrows the input type when true. * * ```ts * const maybeInput = E.bool(true ? true : null); * * if (E.isBoolTruthy(maybeInput)) { * // type: E.BoolTruthy * } * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/isBoolTruthy * * @namespace E * */ /** * Callback executed only for BoolTruthy values. Otherwise, the initial value is returned. * * **Supported call styles:** * - Classic: `whenIsBoolTruthy(input, theFunction)` → returns a value * - Curried: `whenIsBoolTruthy(theFunction)` → returns a function waiting for the input * * If the condition matches, the callback runs; otherwise the original value is returned. * * ```ts * const result = pipe( * E.bool(true ? "value" : null), * E.whenIsBoolTruthy(S.toUpperCase), * ); * * // type: E.BoolFalsy | "VALUE" * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/whenIsBoolTruthy * * @namespace E * */ export declare function boolTruthy(value: GenericValue): BoolTruthy; type Either = Right | Left; export declare function isBoolTruthy(input: GenericInput): input is Extract; type ToEither = GenericValue extends Either ? GenericValue : ReturnType>; export declare function whenIsBoolTruthy(theFunction: (eitherValue: Unwrap>, BoolTruthy>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude>, BoolTruthy>; export declare function whenIsBoolTruthy(input: GenericInput, theFunction: (eitherValue: Unwrap>, BoolTruthy>>) => GenericOutput): GenericOutput | Exclude, BoolTruthy>; export {};