© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
4 replies
rykuno

PGEnum -> Typescript Enum

Hey there. Is there any convenient way people have found to conveniently turn a pgEnum into a typescript enum such as below? Currently I'm creating DTO's but i figured coupling them would be much easier :). I figure ZOD might come into play but we are utilizing NestJS w/ class-validator atm.

const typeEnum = pgEnum('type', [
  'short_text',
  'long_text',
  'single_choice',
  'multiple_choice',
]);

export enum SurveyQuestionType {
  SHORT_TEXT = 'short_text',
  LONG_TEXT = 'long_text',
  SINGLE_CHOICE = 'single_choice',
  MULTIPLE_CHOICE = 'multiple_choice',
}
const typeEnum = pgEnum('type', [
  'short_text',
  'long_text',
  'single_choice',
  'multiple_choice',
]);

export enum SurveyQuestionType {
  SHORT_TEXT = 'short_text',
  LONG_TEXT = 'long_text',
  SINGLE_CHOICE = 'single_choice',
  MULTIPLE_CHOICE = 'multiple_choice',
}
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Typescript enum to pgEnum
Drizzle TeamDTDrizzle Team / help
3y ago
Any easy way to create a typescript ENUM type from pgEnum?
Drizzle TeamDTDrizzle Team / help
3y ago
enum created using pgEnum is shown as not a function
Drizzle TeamDTDrizzle Team / help
4mo ago
varchar but cast to typescript enum?
Drizzle TeamDTDrizzle Team / help
3y ago