How to dynamically select columns in relation query with proper type inference ?
The above example generated following types
But if I use
5 Replies
Give it a try with the new
as const
from TS:
I'm not sure if that's what you want.
If you want it to be dynamic, it's impossible to infer definite types at build time. You'll need some type of generic helper. I'm not completely sure What you're trying to accomplish.You can also do this to generate the object as well:
Will give it a try and let you guys know
Hi, is there a way to exclude certain columns in a similar fashion. I tried Object.fromEntries type of code as given here, but the resulting type is not known and giving errors at run time.
Can you send the code snippet and error in another help thread?