Socket
Socket
Sign inDemoInstall

@kuatsu/prisma-generator-ts-enums

Package Overview
Dependencies
4
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kuatsu/prisma-generator-ts-enums

Automatically generates pure TypeScript enums from the enums in your Prisma schema.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

prisma-generator-ts-enums

Automatically generates pure TypeScript enums from the enums in your Prisma schema.

Semantically released License Code size Written in TypeScript

Why?

If you're like us and love both monorepos and Prisma, you might run into some trouble when trying to use the native Prisma-generated enums from @prisma/client in other apps. For example, this often becomes an issue with React Native / Expo apps that won't correctly run due to it not finding the enums at runtime. Using this generator, you can bypass those issues by generating native TypeScript enums from your Prisma schema.

Installation & Usage

First, install the package.

$ npm install @kuatsu/prisma-generator-ts-enums

or

$ yarn add @kuatsu/prisma-generator-ts-enums

Add the generator

Add the generator to your schema.

generator enum {
  provider = "node node_modules/@kuatsu/prisma-generator-ts-enums" // specify the path to this generator here
  output   = "./enums/index.d.ts" // optionally, you can specify an output filename here -- default is ./types/enums.d.ts
}

Finally, run npx prisma generate or yarn prisma generate and a TypeScript definition file with your enums will be generated in the configured output path.

Example

To see an example, check out the Prisma schema in the prisma directory and the generated enums in the prisma/types directory.

Keywords

FAQs

Last updated on 23 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc