PrismaP
Prisma2y ago
1 reply
powerkuu

How can i get the change the return type of a prisma function based on a generic type?

This code works, but if I change the include parameter it doesn't get reflected in the return type of "prisma.user.findFirst". I know this is more of a typescript question but maybe some of you guys have solved this before?

export async function verifyAuth<I extends Prisma.UserInclude>(token: string, include?: I) {
    return prisma.user.findFirst({
        where: {
            token
        },
        
        include: include
    })
}
Was this page helpful?