.query.with relationship types don't work unless I manually type them out
I thought I had posted this here some time ago, but I can't find the post so I hope I'm not double posting but I'm looking for a bit of guidance.
For reference, I'm creating a bill payment tracker that can be used with multiple people through groups I call "households."
For a while, using the
If I try to call
Here is
But if i try
I thought this was all really weird. Then one day I decided to explicitly define the object, instead of relying on the type inference from the import (abbreviated a bit)
Switching over the
I spoke with a friend on another discord server who is also using drizzle in the same fashion (re-exporting everything from a singular schema file) and his queries have proper relationship suggestions. Any suggestions on moving forward?
For reference, I'm creating a bill payment tracker that can be used with multiple people through groups I call "households."
For a while, using the
db.query.households.findMany({with: { users: true }) gave me proper type inference in my editor. For reference, I have my files split up per the picture, with each table having a separate file, with all exports from those files being re-exported in the index.ts like so:If I try to call
db.query. I get auto complete for the tables, shown in the second screenshot. However, using any with in the clauses later is not populated.Here is
usersToHouseholds.table.ts for referenceBut if i try
await db.query.users.findFirst({ with: { h }}) I do not get the correct values showing up (third picture) I thought this was all really weird. Then one day I decided to explicitly define the object, instead of relying on the type inference from the import (abbreviated a bit)
Switching over the
drizzle(...) call to use this explicit schema gives what I saw before, and what I believe is the expected result (4th image)I spoke with a friend on another discord server who is also using drizzle in the same fashion (re-exporting everything from a singular schema file) and his queries have proper relationship suggestions. Any suggestions on moving forward?

