Generates enums from your prisma schema to typescript or graphql files. Note it doesn't generate the typescript or types for shapes.
npm install prisma-enums-generator
generator enums {
provider = "prisma-enums-generator"
isExport = true
useComma = true
// output = "path to file"
}
generator client {
provider = "prisma-client-js"
}
generator enums {
provider = "prisma-enums-generator"
isExport = true
useComma = true
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum UserType {
pro
best
}
model User {
id String @unique @default(uuid())
name String
username String
type UserType
}
npx prisma generate
It will default generate the following file, prisma/types/index.ts with the following code
export enum UserType {
pro,
best,
}
If you'd like to contribute, please follow our contribution guidelines.
If you like the project, please consider supporting us by giving a ⭐️ on Github.
If you find a bug, please file an issue on our issue tracker on GitHub
prisma-enums-generator is open-source software licensed under the MIT license.