gwilliamnn
gwilliamnn3d ago

Type error using ActoinCache

mport { ActionCache } from "@convex-dev/action-cache";
import { components, internal } from "./_generated/api";
import { action } from "./_generated/server";

export const getAgjdbArqatendCached = new ActionCache(components.actionCache, {
name: "getAgjdbArqatend",
action: internal.actions.internal.getAgjdbArqatendInternal
})

export const getAgjdbArqatendCachedAction = action({
handler: async (ctx): Promise<string> => {
return await getAgjdbArqatendCached.fetch(ctx, {});
}
})
mport { ActionCache } from "@convex-dev/action-cache";
import { components, internal } from "./_generated/api";
import { action } from "./_generated/server";

export const getAgjdbArqatendCached = new ActionCache(components.actionCache, {
name: "getAgjdbArqatend",
action: internal.actions.internal.getAgjdbArqatendInternal
})

export const getAgjdbArqatendCachedAction = action({
handler: async (ctx): Promise<string> => {
return await getAgjdbArqatendCached.fetch(ctx, {});
}
})
'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
No description
1 Reply
ian
ian3d ago
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

Did you find this page helpful?