© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
13 replies
Simon

Drizzle with Zod throws type errors with simple `numeric` example

For example, I define a PostgreSQL table with an input schema:
export const Foo = pgTable('foo', {
  bar: numeric('bar'),
});
export const CreateFooSchema = createInsertSchema(Foo);
export const Foo = pgTable('foo', {
  bar: numeric('bar'),
});
export const CreateFooSchema = createInsertSchema(Foo);


When using this in my API:
create: protectedProcedure
  .input(CreateFooSchema)
  .mutation(({ ctx, input }) => {
    return ctx.db.insert(Foo).values(input);
  }),
create: protectedProcedure
  .input(CreateFooSchema)
  .mutation(({ ctx, input }) => {
    return ctx.db.insert(Foo).values(input);
  }),


I get a type error thrown:
Types of property 'bar' are incompatible.
Type 'string | null | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any> | null'.
Types of property 'bar' are incompatible.
Type 'string | null | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any> | null'.


This is specifically a problem with the
numeric
numeric
and
decimal
decimal
data types. Other standard data types work fine.

Any ideas on a fix?
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 type errors with latest versions
Drizzle TeamDTDrizzle Team / help
3y ago
Drizzle-zod errors
Drizzle TeamDTDrizzle Team / help
2y ago
drizzle-zod type infer
Drizzle TeamDTDrizzle Team / help
3y ago
Struggling to use Zod with Drizzle... Type errors around |undefined
Drizzle TeamDTDrizzle Team / help
2y ago