Reference the same table
Hello,
I use drizzle with a sqlite d1 database.
I have the following schema:
export const authUser = sqliteTable("auth_user", {
id: text("id").notNull().primaryKey(),
email: text("email").notNull().unique(),
firstName: text("first_name").notNull(),
lastName: text("last_name").notNull(),
role: text("role").notNull(), // unassigned, office, construction
verified: integer("verified", { mode: "boolean" }).notNull(),
manager: text("user_id").references(() => authUser.id),
});
But it get the following error:
typescript: 'authUser' implicitly has type 'any' because it does not have a type annotation and is
referenced directly or indirectly in its own initializer.
How can i fix this?3 Replies