Shouldn't the fields related to the Query API be of type <T | undefined> ?
When getting related fields using the findFirst or findMany methods, the appended fields that I bring with "with" should not be of type <T | undefined> so that in case nothing is found it is safe.
Solution:Jump to solution
As far as I can tell, the type of the relation field is nullable when the foreign key column is nullable in the schema (so may not always exist), and non-nullable if the foreign key always exists.
3 Replies