TS2345: PgTableWithColumns<…> from buildable shared-lib not assignable to PgTable<TableConfig>
I’m working in an Nx monorepo with a shared-lib and a Node.js API. Both use Drizzle-ORM (same version), but my API imports tables from the shared-lib. When I try to join one of those tables, TypeScript complains about a type mismatch.
Why does TypeScript see a PgTableWithColumns<…> from my shared-lib as different from the PgTable<TableConfig> expected by .leftJoin, even though both come from the same Drizzle-ORM package? How can I fix this so shared-lib tables join cleanly in my API?
"drizzle-kit": "^0.31.1",
"drizzle-orm": "^0.44.0",
"drizzle-seed": "^0.3.1",
"drizzle-zod": "^0.8.2",
"zod": "^3.25.42"
I'm using zod/v4 everywhere.
15 Replies
check if it isn't anything like what i've had perchance
#Type error when using
drizzle-zod
with sqlite table schema
maybe it's completely different but it's a good thing to check first given that you're in a monorepo
@JROCBABYhmm thanks, but for it it doesn't error in my schema's, my library builds fine, it's in my nodejs api where I get these errors
right but as in trying to delete all
node_modules
foldersYeah I did that 5 times already
regenerated my bun lock and everything
oh right ok. and definitely only ran
bun i
at the top level?
not in any of your workspacesyeah well that's what I thought it was, since NX is apparently unable to sync deps from the root with the workspaces, if they mismatch it starts creating node modules in your workspaces, what a great system
so I removed those and manually aligned the deps but still the same
yeah that's about as much as i know then
lots of issues with
drizzle-zod
tags it seemsnx is giving me so much pain, what a mess
It's so sad that when working with js/ts that 90% of your time gets taken up by solving dumb errors, instead of, you know actually building cool stuff
and it's been like that for over a decade
use turborepo
Did you get the solution?
Yeah the issue is drizzle, it happens in 0.43.0 or something if you downgrade to 0.42 it works
GitHub
[BUG]: Left Join PgColumn Incompatible After the Latest Version · ...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.43.x What version of drizzle-kit...
Thanks bro, that was very helpful.
No worries man