type CacheKey = PropertyKey; export interface UseMemoizeCache { get: (key: Key) => Value | undefined; set: (key: Key, value: Value) => void; has: (key: Key) => boolean; delete: (key: Key) => void; clear(): void; } export interface UseMemoizeOptions { /** * Custom cache key generator * * @defaultValue JSON.stringify(args) */ getKey?: (...args: Args) => string | number; /** * Custom cache, can be a Map or other object that implements the cache interface * * @defaultValue new Map() */ cache?: UseMemoizeCache; } export interface UseMemoizeReturns { /** * Memoized function */ (...args: Args): Result; /** * Load data and replace the cache with the new value */ load: (...args: Args) => Result; /** * Delete cache by args */ delete: (...args: Args) => void; /** * Clear all cache */ clear(): void; /** * Get cache key by args */ getKey: (...args: Args) => CacheKey; /** * A map-like cache object, you can use it to manipulate the cache directly */ cache: UseMemoizeCache; } /** * A React Hook that return a function that memoize value (return same memoized value for same arguments). */ export declare function useMemoize(resolver: (...args: Args) => Result, options?: UseMemoizeOptions): UseMemoizeReturns; export {};