© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•4mo ago
wowzee101

enum created using pgEnum is shown as not a function

I have created a like table that has a likeTypesEnum created using pgEnum in a file. I also have created a comment table that uses the exported likeTypesEnum from the like table. I was writing unit tests for the service functions for the like table but I run into the following TypeError when I try to run the unit tests.

Error:
TypeError: (0 , likeTypesEnum) is not a function

//like.ts
export const like = pgTable(
'like_',
{
id: uuid().primaryKey().defaultRandom(),
userId: uuid()
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
postId: uuid().references(() => post.id, { onDelete: 'cascade' }),
commentId: uuid().references(() => comment.id, { onDelete: 'cascade' }),
type: likeTypesEnum().default('like').notNull(),
...timestamps,
},
);

//comment.ts
export const comment = pgTable(
'comment',
{
id: uuid().primaryKey().defaultRandom(),
userId: uuid()
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
postId: uuid()
.notNull()
.references(() => post.id, { onDelete: 'cascade' }),
parentCommentId: uuid().references((): AnyPgColumn => comment.id, {
onDelete: 'cascade',
}),
content: text().notNull(),
commentLevel: integer().default(0).notNull(),
repliesCount: integer().default(0).notNull(),
likesCount: integer().default(0).notNull(),
topLikeType1: likeTypesEnum(),
topLikeType2: likeTypesEnum(),
...timestamps,
}
);

Why am I getting the the TypeError?
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

PGEnum -> Typescript Enum
Drizzle TeamDTDrizzle Team / help
3y ago
Typescript enum to pgEnum
Drizzle TeamDTDrizzle Team / help
3y ago
pgEnum conversion not working as expected
Drizzle TeamDTDrizzle Team / help
2y ago
Any easy way to create a typescript ENUM type from pgEnum?
Drizzle TeamDTDrizzle Team / help
3y ago