import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common"; import { type Kind } from "../../common/kind"; import { optionalKind } from "./base"; import { optional } from "./create"; import { type Left } from "../left"; import { type Right } from "../right"; export declare const optionalFilledKind: import("../../common").KindHandler>; /** * @deprecated use optionalFilledKind */ export declare const eitherOptionalFilledKind: import("../../common").KindHandler>; type _OptionalFilled = (Right<"optional", GenericValue> & Kind & Kind); export interface OptionalFilled extends _OptionalFilled { } /** * @deprecated use OptionalFilled */ export type EitherOptionalFilled = OptionalFilled; type Either = Right | Left; /** * Type guard that checks that an optional contains a value. * * Signature: `isOptionalFilled(input)` → returns a value * * Acts as a type guard and narrows the input type when true. * * ```ts * const maybeValue = E.optional(true ? "value" : undefined); * * if (E.isOptionalFilled(maybeValue)) { * // type: E.OptionalFilled<"value"> * } * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/isOptionalFilled * * @namespace E * */ /** * Builds an Right<"optional"> when the value is defined. * * Signature: `optionalFilled(value)` → returns a value * * The input value is not mutated. * * ```ts * const result = E.optionalFilled("value"); * * // type: E.OptionalFilled<"value"> * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/optionalFilled * * @namespace E * */ /** * Applies a callback only when the optional Either contains a value (OptionalFilled). * * **Supported call styles:** * - Classic: `whenIsOptionalFilled(input, theFunction)` → returns a value * - Curried: `whenIsOptionalFilled(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.optional(true ? "value" : undefined), * E.whenIsOptionalFilled(S.capitalize), * ); * * // type: E.OptionalEmpty | "Value" * ``` * * @see https://utils.duplojs.dev/en/v1/api/either/whenIsOptionalFilled * * @namespace E * */ export declare function optionalFilled(value: GenericValue): OptionalFilled; export declare function isOptionalFilled(input: GenericInput): input is Extract; type ToOptionalEither = GenericValue extends Either ? GenericValue : ReturnType>; export declare function whenIsOptionalFilled(theFunction: (eitherValue: Unwrap>, OptionalFilled>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude>, OptionalFilled>; export declare function whenIsOptionalFilled(input: GenericInput, theFunction: (eitherValue: Unwrap>, OptionalFilled>>) => GenericOutput): GenericOutput | Exclude, OptionalFilled>; export {};