allenA
Convex Community2y ago
10 replies
allen

ctx.db.get() Always returning a Doc<'users'> typed doc

I have multiple queries for multiple documents structured like so:

export default query({
  args: {
    inviteId: v.id('invites'),
  },
  handler: async(ctx, args) {
    return ctx.db.get(args.inviteId);
  }
});


The typed return of the ctx.db.get is a Doc<'users'> instead of a Doc<'invites'> (or the respective doc type to the provided arg type). If i inspect the type of the ID on the arg its showing as
any
.

This problem emerged today after upgrade convex to latest and adding Convex Auth. This only seems to impact code where the ID is provided on query/mutation args.
Was this page helpful?