backpack1098B
Convex Community9mo ago
2 replies
backpack1098

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:
export const doSomethingAction = internalAction({
  args: {
    userId: v.id("users"),
    // ...other args
  },
  handler: async (ctx, args) => {
    // ...logic
    const result = await ctx.runMutation(internal.someModule.someMutation, {
      // ...args
    });
    return result;
  },
});

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?
Was this page helpful?