Home > Software design >  How to access prisma generated types?
How to access prisma generated types?

Time:09-10

I am using Next.js Prisma NextAuth. I need to access the prisma generated type of one of my tables so that I can extend my NextAuth type from it.

My question is, how do you access the types of User model?

model User {
  id                 String               @id @default(cuid())
  name               String
  nickname           String?              @unique
  email              String               @unique
  emailVerified      DateTime?
  image              String?              @db.VarChar(500)
  title              String?
  description        String?              @db.VarChar(500)
  accounts           Account[]
  sessions           Session[]
  VisitedRestaurants VisitedRestaurants[]
  Reviews            Reviews[]
  ReviewImages       ReviewImages[]
  ReviewLikes        ReviewLikes[]
  ReviewComments     ReviewComments[]
}

CodePudding user response:

That should do the trick:

import type { User } from '@prisma/client'
  • Related