I swear this infer was working... am I crazy?
I swear for a few days, the exported
User
type was working just fine. Suddenly, it is always "any
"
am I remembering wrong, or is this supposed to work?10 Replies
try restarting ur ts server
I
I've seem this error when people uses a reference to the table itself on the 3rd parameter while trying to setup foreign keys
I tried deleting all caches, restarting vs code, restarting ts server and still, no luck 🥲
So it seems its just something I’ll have to wait and hope for an eventual fix with?
I’m not sure exactly what you mean by the 3rd parameter. Could you give me a rough example? I suppose it did happen around the time I was messing with relations and inferred relations
Can you show your table definitions?
I don't see anything wrong with your table definition. Since this is a tested API, the only way to help you is with a reproduction repository... Please create one and I'll take a look
thank you. I will create one as soon as I'm able to find the time
https://github.com/drizzle-team/drizzle-orm/issues/1502
this is exactly the issue I have, for reference
Interesting, does using the
.reference
method on the column work?everything seems to work. just no types. I haven't tested extensively, but I haven't had any actual problems. If I understood correctly, drizzle-kit studio needs to have the relations, as you see in userRelations, from my example in order to work though? I was not able to use drizzle-kit studio unless I provided the userRelations. I believe that is the expected behavior though?
Yes, the nice relational API require you to define the relations. But the reference is to create foreign keys at the db level