Foreign key reference in drizzle causes type error
In my drizzle schema, I have two tables, users and payment_history, when I try to reference the id of payment_history, it throws a type error Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.. users table and payment_history table have a one to many relation where one user can have many payments. These are my schema definition: users:
payment_history:
and these are the table relations: users:
7 Replies
👋
Can you try this?
that works but...how, I tried mentioning the return type like this before:
but this gave me a circular reference type error
Did you find this somewhere in the doc?
no i just figured if the type error is because it has an implicit any type then I should mention the type
the
AnyPgColumn
is a generic but not mentioned that much in the doc 😬.
The reason is https://arc.net/l/quote/bicdfvteNothing wrong with your code, just some TS weird issues
It hates circular references, so we have to rely on a generic to break it
Thanks a ton!!! Following you on twitter!