How do I infer type of pgEnum

How can I infer the type of a pgEnum?
export const roleEnum = pgEnum('role', ['A', 'B', 'C', 'D', 'E'])

// Expected to somehow have type Role = 'A' | 'B' | 'C' | 'D' | 'E'
type Role = typeof roleEnum.$inferMagic
export const roleEnum = pgEnum('role', ['A', 'B', 'C', 'D', 'E'])

// Expected to somehow have type Role = 'A' | 'B' | 'C' | 'D' | 'E'
type Role = typeof roleEnum.$inferMagic
1 Reply
oke
okeOP12mo ago
Okay I just found out I can do it. This question is solved then
type Role = typeof roleEnum.enumValues[number]
type Role = typeof roleEnum.enumValues[number]
Want results from more Discord servers?
Add your server