How do I make Drizzle infer the correct return type when dynamically adding a custom select field
I'm building a query using a helper like this:
Then I pass it into my base query builder:
When execute the query, the response does have the question_count field BUT TypeScript says question_count doesn't exist.
What am I doing wrong here?
4 Replies
I think the following changes fix the return type. See the 4 comments:
Ping for notification
WOW this is amazing! How do you know about SelectedFields and what does it do? I couldn't find it anywhere in the docs
In Cursor, I right clicked on the select method and opened its reference. SelectedFields is the select method's parameter type.
I see. thank you so much 😊