Infer Type from PgEnum

Hey, I'd like to infer a PgEnum to a TypeScript Type.

So something like this:
const eventTypeEnum = pgEnum('event_type', [
    'training',
    'matchday',
    'tournament',
    'event',
    'labour'
]);

// get the following as a result
type EventType = 'training' | 'matchday' | 'tournament' | 'event' | 'labour'


How could I achieve this?
Was this page helpful?