Is there more elegant way to infer enums?

This works: type TransactionReason = (typeof transactionReasonEnum)['enumValues'][number] But I wonder if Drizzle happen to have built-in way to infer TypeScript union from PostgreSQL enum.
1 Reply
petja
petjaOP4mo ago
Made this utility type for myself: export type EnumValues<T extends PgEnum<any>> = T['enumValues'] extends Array<infer U> ? U : never;
Want results from more Discord servers?
Add your server