Select with alias helper
Hello everyone.
I am currently trying to create a function that converts all the columns of a given table to this format: "tablename_columnname"
I almost did it, but my current solution is not fully typescript-friendly: SEE SNIPPET 1
Then when I want to use it "client-side", I have to use it like so: SEE SNIPPET 2
As you can see there's an ugly "as" in the runGuardedQuery function.
One thing that I noticed is that my function does not return the exact same type that this expression returns: SEE SNIPPET 3
It also includes an object containing the keys of the table's interface.
How can I fix this last part? Thanks in advance for the help!
0 Replies