Closed thelinuxlich closed 1 year ago
Would returning a Function be enough? I think it would lead to a better API.
What do you mean? I was thinking of this:
let cache = cache.define(...).define(...)
cache.fetchSomething() // this won't error in TS because we will add a type to the return of define which always merges the current Cache with the new function definition
Any thoughts on this?
bumping because it would be a simple change
That would work.
I was thinking more of
let fecthSomething = cache.define(...)
fetchSomething()
So you mean cache.define returning the newly created function instead of the cache container?
Both are fine, send a PR!
I think it can be done if cache.define return the cache instance instead of void. If you are okay with it, I can prepare a PR.