© 2026 Hedgehog Software, LLC

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

drizzle-zod with custom types

I have defined opaque types in my application and have implemented those in the drizzle schema (awesome and easy to use!). The opaque types are defined using zods Brand feature i.e.
z.string().uuid().brand<"SomeId">();
z.string().uuid().brand<"SomeId">();


I have that defined in the drizzle schema as
someId: uuid("id").$type<SomeId>().notNull()
someId: uuid("id").$type<SomeId>().notNull()


When I use drizzle-zod to create the schema and infer the type, it's coming back as a
z.ZodString
z.ZodString
rather than
z.ZodBranded
z.ZodBranded
.

Is this a bug, a feature that is in development, or simply not supported and I need to override these types?
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

Drizzle-zod createInsertSchema types
Drizzle TeamDTDrizzle Team / help
3y ago
Defining nested types with Drizzle Zod
Drizzle TeamDTDrizzle Team / help
14mo ago
Monorepo drizzle-zod types problem
Drizzle TeamDTDrizzle Team / help
9mo ago
Custom error messages with drizzle-zod?
Drizzle TeamDTDrizzle Team / help
3y ago