Vignesh Gupta
Vignesh Gupta•5mo ago

Loosing Type safety for 1 table only in convex with Turporepo (NextJS)

Hey there, I've recently migrated to turbo repo and trying to figure things using https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo. But for one of the route (or we can say table). I'm having some issues with work_item. On hover Expected is to get something like this on hover:
list: FunctionReference<"query", "public", {
projectId: Id<"projects">;
}, {
_id: Id<"feedbacks">;
_creationTime: number;
status: "open" | "reviewed" | "closed";
type: "documentation" | ... 4 more ... | "other";
projectId: Id<...>;
content: string;
senderName: string;
senderEmail: string;
}[], string | undefined>;
create: FunctionReference<...>;
update: FunctionReference<...>;
remove: FunctionReference<...>;
}
list: FunctionReference<"query", "public", {
projectId: Id<"projects">;
}, {
_id: Id<"feedbacks">;
_creationTime: number;
status: "open" | "reviewed" | "closed";
type: "documentation" | ... 4 more ... | "other";
projectId: Id<...>;
content: string;
senderName: string;
senderEmail: string;
}[], string | undefined>;
create: FunctionReference<...>;
update: FunctionReference<...>;
remove: FunctionReference<...>;
}
instead I'm getting:
(property) work_item: {
[x: string]: any;
}
(property) work_item: {
[x: string]: any;
}
No description
No description
8 Replies
Vignesh Gupta
Vignesh GuptaOP•5mo ago
GitHub
GitHub - vignesh-gupta/projectify: Struggling to stay organized and...
Struggling to stay organized and meet deadlines? Projectify is the ultimate free project management tool for you! Boost your productivity and achieve your goals effortlessly with our intuitive fea...
Vignesh Gupta
Vignesh GuptaOP•5mo ago
Hey @ian, would really appreciate your some help here!
Vignesh Gupta
Vignesh GuptaOP•5mo ago
This issue is causing loose of type. So on filter the individual items comes out to be any
No description
Vignesh Gupta
Vignesh GuptaOP•5mo ago
current workaround is this -
const myTasks = useQuery(api.work_item.list, { projectId: id })?.filter(
(task: Doc<"workItems">) => task.assigneeId === currentUser?._id
);
const myTasks = useQuery(api.work_item.list, { projectId: id })?.filter(
(task: Doc<"workItems">) => task.assigneeId === currentUser?._id
);
but I really would like to understand this issue because this is with only 1 route.
djbalin
djbalin•5mo ago
Replacing import { mutation, query } from "@/convex/_generated/server"; with import { mutation, query } from "./_generated/server"; seems to work. Not sure why 🙂 Also, you're importing from "@/convex/_generated//server" several places (notice the two slashes before server. No clue if this can pose an issue, but it seems strange
djbalin
djbalin•5mo ago
I think you're missing some more config based on the example you linked. E.g.
"workspaces": [
"apps/*",
"packages/*"
],
"workspaces": [
"apps/*",
"packages/*"
],
in the root package.json file. Also I think you should not name your child packages/workspaces as @repo/..., I think that's just the placeholder example from the turborepo example: https://turbo.build/repo/docs/crafting-your-repository/structuring-a-repository#name im no expert in this, but maybe you can troubleshoot based on these points 🙂
Turbo
Structuring a repository | Turborepo
Start by creating a repository using the conventions of the ecosystem.
No description
Vignesh Gupta
Vignesh GuptaOP•5mo ago
Thanks man! Really appreciate your help. and thanks for giving other insight as well. I've just started with tubro repo so it's good to know this things. And yeah, it worked some how
Olamide
Olamide•4mo ago
Your solution just helped me with mine Thank you. This really helped me

Did you find this page helpful?