Action calling an action: "implicit any" error?
Hey all, @erquhart I feel like you'll know this, haha.
I have the simplest action calling another action via
ctx.runAction. It's throwing the classic "implicitly has type 'any' because..." error, but I'd really like to understand why.
(For the record, I have "solved" this by using a helper function, per best practice, instead of an action calling an action. Regardless, I need to understand why this isn't working.)
- I can also annotate it with as { message: ... }, but why would I need to do that when the return type is static and very simple?
- Adding returns argument doesn't solve it either E.g.
Here's the whole setup:
Error in Terminal (note VS Code doesn't show any issues):

2 Replies
The expandable box breaks down the "why" pretty well here: https://docs.convex.dev/functions/actions#dealing-with-circular-type-inference
tl;dr you have to type the return value of the function you're calling (at least the part you're returning from the outer function), or the return type of the outer function. So you can fix by doing:
Note that this isn't a type assertion - if you did
message: number, for example, it would still be a type error. This is just keeping your outer function from relying on inference for the return value of the inner function, as this would be circular inference and isn't resolvable.You are next level @erquhart