M Zeeshan
M Zeeshan4mo ago

Cannot find module dataModel

error:
utils/convex.ts:11:27 - error TS2307: Cannot find module '@/convex/_generated/dataModel' or its corresponding type declarations.

11 import { DataModel } from '@/convex/_generated/dataModel';
utils/convex.ts:11:27 - error TS2307: Cannot find module '@/convex/_generated/dataModel' or its corresponding type declarations.

11 import { DataModel } from '@/convex/_generated/dataModel';
import { DataModel } from '@/convex/_generated/dataModel';
import { GenericQueryCtx } from 'convex/server';

const getUser = async (ctx: GenericQueryCtx<DataModel>) => {
const user = await ctx.auth.getUserIdentity();

if (!user)
throw customConvexError({
type: 'unauthenticated',
message: 'unauthenticaed request',
});

return user;
};

export const secureZodQuery = zCustomQuery(query, {
args: {},
input: async (ctx) => {
const user = await getUser(ctx);

return { ctx: { ...ctx, user }, args: {} };
},
});
import { DataModel } from '@/convex/_generated/dataModel';
import { GenericQueryCtx } from 'convex/server';

const getUser = async (ctx: GenericQueryCtx<DataModel>) => {
const user = await ctx.auth.getUserIdentity();

if (!user)
throw customConvexError({
type: 'unauthenticated',
message: 'unauthenticaed request',
});

return user;
};

export const secureZodQuery = zCustomQuery(query, {
args: {},
input: async (ctx) => {
const user = await getUser(ctx);

return { ctx: { ...ctx, user }, args: {} };
},
});
1 Reply
M Zeeshan
M ZeeshanOP4mo ago
vs code typescript intellisense wroks get error while depoying convex functions in dev mode

Did you find this page helpful?