Property '[IsDrizzleTable]' is missing in type

Hello! I've just updated to drizzle-orm@0.29.1 and I can't use drizzle-zod anymore (@0.5.1). This is my code:
export const GroupCategoriesInsertSchema = createInsertSchema(
groupCategories,
)
export const GroupCategoriesInsertSchema = createInsertSchema(
groupCategories,
)
Gives me the following error:
Argument of type 'PgTableWithColumns<{ name: "group_categories"; schema: undefined; columns: { id: PgColumn<{ name: string; tableName: "group_categories"; dataType: "string"; columnType: "PgVarchar"; data: string; driverParam: string; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, {}, {}>; ... 6 more ...; ...' is not assignable to parameter of type 'Table<TableConfig<Column<any, object, object>>>'.
Argument of type 'PgTableWithColumns<{ name: "group_categories"; schema: undefined; columns: { id: PgColumn<{ name: string; tableName: "group_categories"; dataType: "string"; columnType: "PgVarchar"; data: string; driverParam: string; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, {}, {}>; ... 6 more ...; ...' is not assignable to parameter of type 'Table<TableConfig<Column<any, object, object>>>'.
What can I do?
9 Replies
benjick
benjick8mo ago
Here's is the table itself:
export const groupCategories = pgTable("group_categories", {
id: pgTypeId("gc").primaryKey(),
groupId,
name: varchar("name", { length: 256 }).notNull(),
public: boolean("public").notNull().default(false),
defaultCollapsed: boolean("default_collapsed").notNull().default(true),
sortIndex: integer("sort_index").notNull().default(0),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow(),
});
export const groupCategories = pgTable("group_categories", {
id: pgTypeId("gc").primaryKey(),
groupId,
name: varchar("name", { length: 256 }).notNull(),
public: boolean("public").notNull().default(false),
defaultCollapsed: boolean("default_collapsed").notNull().default(true),
sortIndex: integer("sort_index").notNull().default(0),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow(),
});
Sayykii
Sayykii8mo ago
have the same issue aswell
joshpachner
joshpachner8mo ago
I have the same error too. Strangely its not a problem when its in my node app. But when in my Deno, imported via esm.sh then thats when it throws the error.
"drizzle-pg-core":"https://esm.sh/drizzle-orm@0.28.6/pg-core",
"drizzle-orm":"https://esm.sh/drizzle-orm@0.28.6"
"drizzle-pg-core":"https://esm.sh/drizzle-orm@0.28.6/pg-core",
"drizzle-orm":"https://esm.sh/drizzle-orm@0.28.6"
any help would be greatly appreciated 🙏
No description
joshpachner
joshpachner8mo ago
Looks like the relations() function expects a pgTable that has been updated its config to have the IsDrizzleTable field. But idk if im suppose to be using a different pgTable() when declaring the table. Or use pgTable() but then add somehow a IsDrizzleTable = true in its config 🤷‍♂️
joshpachner
joshpachner8mo ago
The issue really is an intelisense thing, the querying works. But vscode thinks that the return type for the relations field is 'never'
No description
joshpachner
joshpachner8mo ago
The more i look at it, it might be a Deno intelisense issue... aight well i switched running the vscode from my laptop to my desktop. And now there's no intelisense error. 🤷‍♂️ im an idiot, but lucky at the same time i guess
benjick
benjick8mo ago
I'm not using deno
fanckush
fanckush7mo ago
I have the same issue
joshpachner
joshpachner7mo ago
@fanckush there's reported issues all over github about the vscode intelisense for Deno. Which is a bummer because honestly thats the only hiccup i have with Deno. I love the concept of it but just the DX is suffering rn 😢 But in case you're using the denoland drizzle library. I would recommend you dont. and rather just import the version you want via esm (especially if you are using drizzle relations since the denoland drizzle highest version came out prior to the drizzle relations)
Want results from more Discord servers?
Add your server
More Posts