The types says that the return value of the provided function is stored in the cache. This works fine for non async functions but if a async function is provided this will result in the stored value is a promise and not the value the promise will resolve.
Since the provided function is always awaited the Awaited type can be used to get the resolved value of a promise.
Also update the type in the readme example so it doesn't generate an error, but maybe it should just be removed since it will be correctly inferred by TypeScript.
The types says that the return value of the provided function is stored in the cache. This works fine for non async functions but if a async function is provided this will result in the stored value is a promise and not the value the promise will resolve.
Since the provided function is always awaited the
Awaited
type can be used to get the resolved value of a promise.Fixes https://github.com/jperasmus/stale-while-revalidate-cache/issues/26
Also update the type in the readme example so it doesn't generate an error, but maybe it should just be removed since it will be correctly inferred by TypeScript.