hi, is it possible to parameterize the `include` f...
# orm-help
m
hi, is it possible to parameterize the
include
field of a query and still retain the Typescript types? eg:
Copy code
export const findById = async (id: number, include: Prisma.ClaimInclude | undefined = undefined) => {
    return dbClient.claim.findUnique({
        where: {
            id,
        },
        include,
    })
}
and use it like this:
const claim = await findById(claimId , { assignedTo: true, })
currently I cannot access
claim.assignedTo
Property 'assignedTo' does not exist on type 'Claim & {}'. Did you mean 'assignedToId'? ts(2551)
thanks
t
Use this: EDIT: see below
m
that is a syntax error...
t
findUnique({
where: { id: id },
include: { assignedTo: true },
})
m
well, my goal is to not hardcode the include field but to use it as parameter