ossuboi
DTDrizzle Team
•Created by ossuboi on 10/2/2024 in #help
Typing issue - findFirst/findMany `with` parameter with a dynamic value
I am having an issue using findFirst and findMany where including a dynamic value for the
with
parameter breaks the types for the output.
Here's a simplified example of what I have going on:
When calling the findWorkById
method with the scope being extended
I would expect the type of the returned value to be:
But whatever I pass as the scope
value the return type is always the 'base' type for the work schema which is:
When I provide the { workDescription: true, workContact: true }
directly to the with parameter, without the ternary, the the returned object has the correct type.
Has anyone faced this issue and have a good solution? Do I just have morning-brain and am missing something silly?
Any help is appreciated!3 replies