How can I extend drizzle tables?
I noticed that I write a lot of boilerplate code. When I had to update one of such types, I refactored them a bit, into reusable thing:
This worked out pretty well for that time. But now, I keep writing tons of services, and I want to make some reusable functions, but I struggle with TS trying to do that. i.e. I want to make a service
getItems
:
But types on this thing are totally wrong, and I'm not sure where should I start to approach this problem.
Another example, I have some subqueries like these:
It would be nice if I could refactor it into getID
, that takes Table as prop:
But I just don't get how to define the Table type in TS.0 Replies