export type TGetCurryFnArgs = Parameters; export type TGetCurryFnReturn = ReturnType; /** * Curries a function, transforming it into a sequence of unary functions. * Collects arguments one by one until `arity` is reached, then invokes `fn`. * * @template {(...args: any[]) => any} T * @param {T} fn Function to curry * @param {number} [arity=fn.length] Number of arguments to collect before invoking * @returns {((arg: Parameters[0]) => ReturnType | any) & ((...args: Parameters) => ReturnType)} * @throws {TypeError} getCurryFn: fn must be a function * @throws {TypeError} getCurryFn: arity must be a non-negative integer * * @example * function sum(a: number, b: number) { return a + b; } * const curried = getCurryFn(sum); * curried(1)(2); // 3 * @example * // Build reusable field validators from a curried range check * const isInRange = getCurryFn((min: number, max: number, value: number) => { * return value >= min && value <= max; * }); * const isValidPercentage = isInRange(0)(100); */ export declare const getCurryFn: any>(fn: T, arity?: number) => ((arg: Parameters[0]) => ReturnType | any) & ((...args: Parameters) => ReturnType);