You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that if you pass a fn returning Promise<MyType>, and you need to use your own custom cache, you need to pass e.g. Map<string, {data: MyType, maxAge: number}>, which is incorrect; the cache will store Promise<MyType> in the data field of each cache entry.
Currently the only way to compile code using p-memoize and a custom cache is to type the custom cache values as any.
By using the same type for the return type of fn and the data entries, the error is resolved.
The current interface in index.d.ts:
This means that if you pass a
fn
returningPromise<MyType>
, and you need to use your own custom cache, you need to pass e.g.Map<string, {data: MyType, maxAge: number}>
, which is incorrect; the cache will storePromise<MyType>
in thedata
field of each cache entry.Currently the only way to compile code using p-memoize and a custom cache is to type the custom cache values as
any
.By using the same type for the return type of
fn
and thedata
entries, the error is resolved.Fixed by #27
The text was updated successfully, but these errors were encountered: