Dbeg
DTDrizzle Team
•Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
Thanks @Cayter So I do have that and I realise I poorly worded my question.
I actually was wondering if there was something along the lines of drizzle infer type from a schema method but for relations querties.
so say I have a post table
I can do something like this
I now have the exact type for Post that I can use, in say props for a component.
Is there a way I could get a type for what is inferred? @mcgrealife method actually worked as well where i just take the inferred return type. Did not see anything in the docs about it get an explicit type for what a relation query could return.
12 replies
DTDrizzle Team
•Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
You probably were doing this but for anyone else, the return type of the async func would be a union type of the type | undefined wrapped in a promise. So this is what I did to get the exact type:
@mcgrealife Is this what you also had to do? or did I just do some longer for no reason. 🤣
12 replies
DTDrizzle Team
•Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
Oh ok yes that works! Thanks 😊
12 replies