© 2026 Hedgehog Software, LLC

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

How to Reference a Column Type in Drizzle

Hi everyone! I used to work with Prisma, and now I've started learning Drizzle. I have a problem: is it possible to reference the type of a specific column in a table? If so, how?

In Prisma, I solved it like this:
import { Pet } from '@prisma/client';
selectedID: Pet['id'] | null;
import { Pet } from '@prisma/client';
selectedID: Pet['id'] | null;


However, this approach doesn't work in Drizzle, and I get the following error:
'verificationTokens' refers to a value, but is being used as a type here. Did you mean 'typeof verificationTokens'?
I tried with typeof but it did not work.

Here is my code:
import { users, verificationTokens } from '@/db/schema';
type VerificationType = {
    email:  verificationTokens['email'];
    token:  verificationTokens['token'];
};
import { users, verificationTokens } from '@/db/schema';
type VerificationType = {
    email:  verificationTokens['email'];
    token:  verificationTokens['token'];
};



Thanks in advance for the help.
image.png
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

In a relation subquery, how to reference parent column?
Drizzle TeamDTDrizzle Team / help
2y ago
Foreign key reference in drizzle causes type error
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle Kit: Push Wants to Update Unchanged Column Type
Drizzle TeamDTDrizzle Team / help
3y ago