type CachedKey = string | number; const cachePromise = new Map>(); export const getCachePromise = (cacheKey: CachedKey) => { return cachePromise.get(cacheKey); }; export const setCachePromise = (cacheKey: CachedKey, promise: Promise) => { cachePromise.set(cacheKey, promise); promise.finally(() => { console.log("finally: promise"); cachePromise.delete(cacheKey); }); };