© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
1 reply
Liltripple_reid

drizzle-zod failing

the createInsertSchema function is throwing errors when being used with
@hookform/resolvers/zod
@hookform/resolvers/zod
, it's weird

// Form component
...
  const form = useForm<NewComputer>({
    resolver: zodResolver(insertComputerSchema),
  });
...
// Form component
...
  const form = useForm<NewComputer>({
    resolver: zodResolver(insertComputerSchema),
  });
...

throws this
Argument of type 'ZodObject<{ id: ZodString; brand: ZodString; cores: ZodNumber; }, UnknownKeysParam, ZodTypeAny, { id: string; brand: string; cores: number; }, { ...; }>' is not assignable to parameter of type 'ZodType<any, any, any>'.
  The types of 'refine(...)._def.typeName' are incompatible between these types.
    Type 'Zod.ZodFirstPartyTypeKind.ZodEffects' is not assignable to type 
Argument of type 'ZodObject<{ id: ZodString; brand: ZodString; cores: ZodNumber; }, UnknownKeysParam, ZodTypeAny, { id: string; brand: string; cores: number; }, { ...; }>' is not assignable to parameter of type 'ZodType<any, any, any>'.
  The types of 'refine(...)._def.typeName' are incompatible between these types.
    Type 'Zod.ZodFirstPartyTypeKind.ZodEffects' is not assignable to type 


schema and insertSchema declarations

export const computers = mysqlTable("computers", {
  id: varchar("id", { length: 36 }).notNull().primaryKey(),
  brand: varchar("brand", { length: 256 }).notNull(),
  cores: int("cores").notNull(),
});

// Schema for CRUD - used to validate API requests
export const insertComputerSchema = createInsertSchema(computers);
export const computers = mysqlTable("computers", {
  id: varchar("id", { length: 36 }).notNull().primaryKey(),
  brand: varchar("brand", { length: 256 }).notNull(),
  cores: int("cores").notNull(),
});

// Schema for CRUD - used to validate API requests
export const insertComputerSchema = createInsertSchema(computers);
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Drizzle-Zod
Drizzle TeamDTDrizzle Team / help
9mo ago
Drizzle-zod errors
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle-zod combined with regular zod? 🙃
Drizzle TeamDTDrizzle Team / help
15mo ago
Drizzle-Zod extend schema....
Drizzle TeamDTDrizzle Team / help
14mo ago