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?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?