The async function type to memoize.
A memoized async function returning cached or pending results.
const fetchUser = memoizeAsync(async (id: number) => {
console.log("Fetching user:", id);
return { id, name: "User" + id };
});
await fetchUser(1); // Executes
await fetchUser(1); // Returns cached promise
Memoizes an asynchronous function by caching its resolved promises based on a deterministic key derived from its arguments.
Supports deep object keys via stableStringify and allows a custom cache resolver for flexible key generation.
Ensures that concurrent calls with the same arguments share the same in-flight promise.