powerkuu
powerkuu
Explore posts from servers
PPrisma
Created by powerkuu on 7/17/2024 in #help-and-questions
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
})
}
export async function verifyAuth<I extends Prisma.UserInclude>(token: string, include?: I) {
return prisma.user.findFirst({
where: {
token
},

include: include
})
}
2 replies