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
Here's a simplified example of what I have going on:
When calling the
But whatever I pass as the
When I provide the
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!
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!