Infinite reference needs type annotation
This basic example will keep shouting because user refers to badge and badge refers to user
how would you guys go about solving it?
import { integer, pgTable, serial, varchar as string } from "drizzle-orm/pg-core";
const user = pgTable("users", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
badgeId: integer("badge_id").notNull().references(() => badge.id),
});
const badge = pgTable("badges", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
createdBy: integer("created_by").notNull().references(() => user.id), // THIS LINE
});