Issue with drizzle-zod?

Schema

export const testinArray = pgTable("testing_array", {
  id: varchar("id", { length: 14 })
    .primaryKey()
    .$defaultFn(() => nanoid(14)),
  names: text("names").array(),
});


const testingSchema = createInsertSchema(testinArray);
const data = { names: ["test1", "test2"] };
const newData = testingSchema.parse({ ...data });
db.insert(testinArray).values(newData).execute();


No overload matches this call.
  Overload 1 of 2, '(value: { id?: string | SQL<unknown> | Placeholder<string, any> | undefined; names?: string[] | SQL<unknown> | Placeholder<string, any> | null | undefined; }): PgInsert<...>', gave the following error.
      Type '{ id?: string | undefined; names?: string | null | undefined; }' is missing the following properties from type '{ id?: string | SQL<unknown> | Placeholder<string, any> | undefined; names?: string[] | SQL<unknown> | Placeholder<string, any> | null | undefined; }[]': length, pop, push, concat, and 35 more.ts(2769)
const newData: {
    id?: string | undefined;
    names?: string | null | undefined;
}
Was this page helpful?