You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Getting the following error - Type 'string' is not assignable to type 'undefined'. when generating the zod schema from prisma
Screenshots
Package versions (please complete the following information):
zod: 3.22.4
prisma: 5.7.1
zod-prisma-types: 3.1.6
Additional context
I am using next.js and Supabase with prisma and trying to add Zod in the project. The prisma schema usage works fine in app. Here is the prisma schema. I am using "prisma generate --no-engine".
Had same problem. Prisma v5.6.0, Zod v3.22.4, zod-prisma-types v3.1.6. Tsconfig has strict and strictnullchecks as true, didn't work. Only using 'useTypeAssertions' flag at least made the tsc errors go away.
Describe the bug
Getting the following error - Type 'string' is not assignable to type 'undefined'. when generating the zod schema from prisma
Screenshots
Package versions (please complete the following information):
Additional context
I am using next.js and Supabase with prisma and trying to add Zod in the project. The prisma schema usage works fine in app. Here is the prisma schema. I am using "prisma generate --no-engine".
generator client {
provider = "prisma-client-js"
}
generator zod {
provider = "zod-prisma-types"
}
generator erd {
provider = "prisma-erd-generator"
disabled = true
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
model User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
name String
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
email String @unique
password String
status UserStatus @default(PENDING)
profile Profile?
role UserRole @default(ADMIN)
type UserType @default(CUSTOMER)
survey Survey?
}
model Profile {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
user User? @relation(fields: [userId], references: [id])
userId String @db.Uuid @unique
}
model Survey {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
user User? @relation(fields: [userId], references: [id])
userId String? @db.Uuid @unique
question1 String?
question2 String?
}
enum UserStatus {
PENDING
VERIFIED
}
enum UserRole {
USER
ADMIN
}
enum UserType {
CUSTOMER
INTERNAL
}
The text was updated successfully, but these errors were encountered: