Typing columns based on Table
I'm trying to make a generic
paginateQuery
function that would let me pass in the table and then an array of only columns from that table would be accepted. Is there any way to do this with the Drizzle types? I feel like I have gotten close a few times but nothing fully gets there. Thanks!
2 Replies
Wish I had given it a few more minutes...
this might work, i have to restructure some stuff to see, but it autocompletes the strings in the array when I use the function. not sure if there is a better way to do it where I can pass in
table.id
instead of "id"
, would still love to know that
Nevermind again! Man I took so long working on this and got there right as I posted it :P Here is my final product:
@ngregrichardson nice! do you have ane example using the
paginatedQuery
? I am having trouble passing a value that satisfies TTable type.