I'm receiving error when trying to do a self referencing

I saw somewhere in this discord this self referencing coz this also receives type error too
replyToId: integer("reply_to_id").references(() => Comment.id),



export const Comment = pgTable(
  "comments",
  {
    id: serial("id").primaryKey(),
    content: text("content").notNull(),
    postId: integer("post_id").references(() => Post.id),
    authorId: integer("author_id").references(() => Profile.id),
    createdAt: timestamp("created_at").notNull().defaultNow(),
    updatedAt: timestamp("updated_at").notNull().defaultNow(),
    replyToId: integer("reply_to_id").references(() => Comment.id),
  }}
);
image.png
Was this page helpful?