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',
}
Was this page helpful?