▲ 4 r/nextjs
What am I missing with Prisma and Types?
Hi all,
I am building a new app in Next.js and Prisma, because I saw the hype online.
My previous application was raw SQL, which was fine, and I could use promises of types to help with type safety.
So, in my new project I have two files
types.ts
schema-prisma.ts
Let's say I have a type of Book
export type Book { id: string, pages: number; title: string }
Then, you have the same in Prisma to store books
Model Book { id: string , pages: number; title: string }
So, the second you make a change to your type of Book, like adding new data or making something null, you need to go back into the prisma schema to make it match.
What should I be doing?
AI suggests to delete types.ts and use the schema prisma as the types, is that correct?
u/grand-yojimbo — 3 days ago