drizzle-orm: [BUG]: Splitting database schemas into a separate package in monorepo causes TS2345 Property `[IsDrizzleTable]` is missing in type
What version of drizzle-orm are you using?
0.29.0
What version of drizzle-kit are you using?
0.20.4 (but not relevant)
Describe the Bug
- Copy/paste the example drizzle adapter code from https://github.com/nextauthjs/next-auth/blob/693a0723a7bad2b0950e4c6006a99c98852c4beb/packages/adapter-drizzle/src/lib/pg.ts into my own project
- Note that the example code works (leave aside the deprecated
primaryKey(col1, col2), which I fixed). - My project is a monorepo, so the database schemas (which were in Prisma) are in a separate package. Move the table definitions for
users,accounts,sessions, andverificationTokensinto a separate package, wheretsc --buildis producing adist/folder andpackage.json’sexportsreferencesdist/index.d.tsetc., then import the table definitions in the originalapppackage which is making theinsertcalls. - Receive the following error:
TS2345andProperty [isDrizzleTable] is missing in type:
the compiled .d.ts looks like this:
Expected behavior
Not to have the tsc error. I expect the types to be portable.
Environment & setup
I use a monorepo with pnpm and syncpack and have confirmed that both the main app package and the database schema package are using the same 0.29.0 version of drizzle-orm.
About this issue
- Original URL
- State: open
- Created 7 months ago
- Reactions: 1
- Comments: 31
I consulted the team, They’re looking into the bundler thing. I wasn’t aware of that and the consequences, mostly because it hasn’t affected my own setup. We’ll see.
Just submitted a pr to your reproduction. Please see my notes there. Take a look and let me know if we can close this issue.
Fixed!
It was because I was using different versions of drizzle orm inside my workspaces. So if you update all the drizzle orms to the same version it will work nicely!!