Type Inference Lint Errors When Returning Mutation Result in Internal Action
I'm encountering a TypeScript linting issue inside an internal action function. Here’s a simplified version of the function signature:
When I assign the result of ctx.runMutation to a variable (e.g., const result = ...) and return it, I get a series of "implicitly has type 'any'" linter errors for the result and related variables. However, if I remove the assignment and the return statement (i.e., I don't assign or return the mutation result), the lint errors disappear.
Why does returning the result of ctx.runMutation in an internal action trigger these implicit 'any' type errors, and is there a recommended way to resolve this while still returning the mutation result?
2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
It’s circular inference. Here’s how to deal with it: https://docs.convex.dev/functions/actions#dealing-with-circular-type-inference