c1re_
c1re_
DTDrizzle Team
Created by c1re_ on 8/24/2023 in #help
Drizzle-zod createInsertSchema types
if I have a schema :
export const listings = pgTable("listings", {
id: serial("id").primaryKey(),
...
squareFeet: integer("sq_ft").notNull(),
description: text("description").notNull(),
...
});
export const listings = pgTable("listings", {
id: serial("id").primaryKey(),
...
squareFeet: integer("sq_ft").notNull(),
description: text("description").notNull(),
...
});
it seems like text and varchar column types get inferred as ZodString which I'd expect. However, integer, serial, dates, etc are just inferred as ZodAny. Is this expected? Do i just need to do some base checks in refine to make sure integers,booleans etc are correct? Docs lead me to believe i should be able to apply a refine to the id field like { id: (schema) => schema.id.positive(), } however I am getting an error positive does not exist on type 'ZodAny' where I'm assuming id should be of type ZodNumber
3 replies