Type error using ActoinCache
'getAgjdbArqatendCached' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
Some one can help me to understand this error?
On the backend the function is working, but that type error is anoying
5 Replies
Add return types to the handler of what is using the cache, not just the cached action. if those are depending on the cached action type for their return values. https://github.com/get-convex/cache/blob/main/README.md#L18-L28
the cache cannot be exported for the typesafety to work
I have done so successfully, so I'm curious what issue your running into and what type definitions might be necessary to help the typscript language server out.
And you're on the latest version?
yes i'm on the right version
i believe there's probably an import cycle of some sort
Correct. The two ways of solving this are:
1. Define
export const getAgjdbArqatendCached
in a separate file from the action it's referencing
2. Don't export
it. Just const getAgjdbArqatendCached
It both impacts the internal.actions.internal
type (by exporting) and depends on it (internal.actions.internal.getAgjdbArqatendInternal
)