© 2026 Hedgehog Software, LLC

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

How to define types for jsonb

How do you provide custom type interfaces for jsonb columns returned via queries.

for instance if i have a column:
myfield: jsonb('data').notNull()
myfield: jsonb('data').notNull()


i want to be able to define a type interface for
myfield
myfield
such that when i do
const { myfield } = await db.query.myTable.findFirst({})
const { myfield } = await db.query.myTable.findFirst({})
, the type of myfield is customized instead of
unknown
unknown


im aware of this page in the docs (https://orm.drizzle.team/docs/custom-types) but i think this is not actually for what im talking about but maybe im dumb
Common way of defining custom types – DrizzleORM
Drizzle ORM | %s
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

how to define relations for friendship?
Drizzle TeamDTDrizzle Team / help
2y ago
How to define schemas for friendship table
Drizzle TeamDTDrizzle Team / help
3y ago
Is there a way to define "nullable" types for magic SQL?
Drizzle TeamDTDrizzle Team / help
2y ago
how to define array relations ?
Drizzle TeamDTDrizzle Team / help
3y ago