Property '[IsDrizzleTable]' is missing in type

Hello! I've just updated to [email protected] 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?
10 Replies
benjick
benjickOP12mo 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
Sayykii12mo ago
have the same issue aswell
joshpachner
joshpachner12mo 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/[email protected]/pg-core",
"drizzle-orm":"https://esm.sh/[email protected]"
"drizzle-pg-core":"https://esm.sh/[email protected]/pg-core",
"drizzle-orm":"https://esm.sh/[email protected]"
any help would be greatly appreciated 🙏
No description
joshpachner
joshpachner12mo 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
joshpachner12mo 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
joshpachner12mo 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
benjickOP12mo ago
I'm not using deno
fanckush
fanckush12mo ago
I have the same issue
joshpachner
joshpachner12mo 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)
Pelps
Pelps5mo ago
I'm currently getting the same error with a Hono cloudflare worker in a Turborepo
Want results from more Discord servers?
Add your server