/** * A memoized function with cache clearing capability. */ export type Memoized any> = { (this: ThisParameterType, ...args: Parameters): ReturnType; /** Clears the memoization cache */ clearCache: () => void; }; /** * Default equality check that compares arguments using Object.is(). * * @param prevArgs - Previous function arguments * @param nextArgs - Current function arguments * @returns True if all arguments are equal */ export declare function defaultEqualityCheck(prevArgs: any[], nextArgs: any[]): boolean; /** * Memoizes function calls, caching only the most recent result to prevent redundant async validations. * * Built-in implementation based on memoize-one with enhanced async support. * Can be replaced with other memoization libraries if needed. * * @param fn - The function to memoize * @param isEqual - Custom equality function to compare arguments (defaults to shallow comparison) * @returns Memoized function with cache clearing capability * * **Example:** * ```ts * // Async validation with API call * const validateUsername = useMemo( * () => memoize(async function isUnique(username: string) { * const response = await fetch(`/api/users/${username}`); * return response.ok ? null : ['Username is already taken']; * }), * [] * ); * * // Usage in form validation * async onValidate({ payload, error }) { * if (payload.username && !error.fieldErrors.username) { * const messages = await validateUsername(value.username); * if (messages) error.fieldErrors.username = messages; * } * return error; * } * ``` */ export declare function memoize any>(fn: T, isEqual?: (prevArgs: Parameters, nextArgs: Parameters) => boolean): Memoized; //# sourceMappingURL=memoize.d.ts.map