sqlitetable circular reference

I'm trying to create a self referencing table using sqlite, here is what I'm doing
export const forms = sqliteTable("forms", {
id: int("id").primaryKey(),
name: text("name").notNull(),
description: text("description"),
categoryId: int("category_id").references(() => categories.id),
slug: text("slug").notNull(),
version: text("version").notNull().default("1.0"),
active: integer("active", { mode: "boolean" }).notNull().default(true),
parentFormId: int("parent_form_id").references(() => forms.id),
createdAt: integer("created_at", { mode: "timestamp" })
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
export const forms = sqliteTable("forms", {
id: int("id").primaryKey(),
name: text("name").notNull(),
description: text("description"),
categoryId: int("category_id").references(() => categories.id),
slug: text("slug").notNull(),
version: text("version").notNull().default("1.0"),
active: integer("active", { mode: "boolean" }).notNull().default(true),
parentFormId: int("parent_form_id").references(() => forms.id),
createdAt: integer("created_at", { mode: "timestamp" })
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
but I'm getting this type error Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.ts(7024) Is there any way to structure this to to remove the TS warning?
1 Reply
rogueturnip
rogueturnipOP5d ago
I solved it by using an :AnySqliteColumn on the reference.
Want results from more Discord servers?
Add your server