Drizzle complains when I'm trying to insert into a table.
I have a schema that looks like this:
and when I'm trying to run a query against it:
typescript complains that my data is wrong:
if I add
as any
at the end it works, but I'd rather not opt-out of type-safety. What am I doing wrong?3 Replies
In order to fix your issue what you need to do is to transform the
Date
objects to String
using (for example):
I tested your code snippet and the error is indeed on the id for some reason, but this solution should resolve your issue (worked for me at least).
It might be worth to do additional digging to find out why the error is displayed on the id
field.you can also change
mode
to date
for createdAt and updatedAt columns insteadthanks
i ended up not migrating my project to drizzle though as the were too many problems with it