Hi, how do i generate optional Prisma Client Types...
# orm-help
i
Hi, how do i generate optional Prisma Client Types for this schema
Copy code
// schema
model User {
  id         Int     @id @default(autoincrement())
  facebookId String? @unique
  googleId   String? @unique
  profileURL String?
}

//desired type generated on the client
export type User = {
  id: number
  facebookId?: string | null
  googleId?: string | null
  profileURL?: string | null
}

// what is really generated
export type User = {
  id: number
  facebookId: string | null
  googleId: string | null
  profileURL: string | null
}
r
@Ibrahim 👋 The Prisma types generated are correct. Your field is unique so it can only be
null
and never
undefined
. There will always be a value or it would be null as per the database constraints so what you want it not possible.