Dynamic select column doesn't return the correct type
Hello, I have an issue with a particular query I'm trying to run. I have a relation model called 'Posts' and in this particular query I only want to include posts if a specific condition is met before hand (i.e.
condition ? { /* select */ } : false
). When doing this the return type changes, seek below result.
This is the return type
But if I remove the userViewFlag !== "unauthenticated"
check this is the type output (the expect output).
Curious if there is something I can do to make this work a better or if I may have missed something.2 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai
is there if you need a quick second opinion.I'm on version 6.6.0 FYI
I think the workarounds that don't involve doing what I am above would be
- Always including it and filtering it out in a DTO
- Get the posts in a separate query
Would prefer the types for this particular query to yield what I expect. I also notice that it isn't able to decern the type for
email
which in my eyes would be email? string
. Just small things.