/** * Memoizes the result of an async loader function. * * - The loader is only executed once. * - Concurrent callers share the same in-flight promise. * - Subsequent calls return the cached value. * * Example usage: * * const getSomeData = memoize(async () => { * return await loadSomethingExpensive(); * }); * * Or just use: * * const getSomeData = memoize(loadSomethingExpensive); * ... * // Slow in the first call, immediate in subsequent calls. * const data = await getSomeData(); * */ declare function memoize(loader: () => Promise): () => Promise; export { memoize };