UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

11 lines (10 loc) 602 B
import type { Arguments } from "../util/function.js"; import { type Lazy } from "../util/lazy.js"; /** * Use a memoised value with lazy initialisation. * - Returns `value` (if not a function) or the result of calling `value(...args)` (if a function). * - Returns same `value` for as long as `args` is equal to previous `args`. */ export declare function useLazy<T, A extends Arguments = []>(value: (...args: A) => T, ...args: A): T; export declare function useLazy<T>(value: T, ...args: Arguments): T; export declare function useLazy<T, A extends Arguments = []>(value: Lazy<T, A>, ...args: A): T;