Teodoro
Teodoro

Reputation: 1474

Export server-side Prisma models for client-side usage

Is there any automated way to export the type definitions of my models generated with prisma generate but without the database CRUD methods? Then I could export them as a model module and use type definitions on client-side.

Upvotes: 1

Views: 791

Answers (1)

Ahmed Elywa
Ahmed Elywa

Reputation: 479

You can use Pal.Js CLI to generate TypeScript definitions from your schema.prisma file and use in any place

yarn global add @paljs/cli
//or
npm install -g @paljs/cli

then run

pal s typescript

will generate typescript file for you have all models and enums

Docs here

Upvotes: 3

Related Questions