In my Prisma schema, I have defined the following model:
model User {
id String @id @default(uuid())
name String
email String @unique
}
After writing the TypeScript code below, I expected the return type of the user
variable to be correctly inferred. However, it is being inferred as type any
. Is this the expected behavior of Prisma or am I missing something?
const user = await prisma.user.findUnique({
where: {
email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7d6d5d4f7d2cfd6dac7dbd299d4d8da">[email protected]</a>",
}
});
By the way, I am using Prisma version 5.2.0
I have run npx prisma generate
, which successfully generates proper type inference for input parameters. For instance, if a wrong field is set in the where clause, the editor shows an error. However, only the return value is inferred as Promise<any>