© 2026 Hedgehog Software, LLC

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

varchar but cast to typescript enum?

I have the following table:
export const Table = pgTable('table', {
  ...
  status: varchar('status', { length: 32 }).notNull(),
  ...
export const Table = pgTable('table', {
  ...
  status: varchar('status', { length: 32 }).notNull(),
  ...


The type of this field will be string. I don't want to use a db enum, but I want to automatically define the type of this field as
type STATUS
type STATUS
, which is a TS enum.

How would I do this?
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
PGEnum -> Typescript Enum
Drizzle TeamDTDrizzle Team / help
3y ago
Typing `varchar` with a type reference instead of `enum` value
Drizzle TeamDTDrizzle Team / help
2y ago
Is there a simpler way to get an enum type than (typeof enumType)["enumValues"][number]?
Drizzle TeamDTDrizzle Team / help
3y ago