No overload matches this call
I'm getting no overload matches this call error (more info on the screenshot).
7 Replies
I've defined schema this way:
When I do this, I get that error.
Hello. Can anyone please tell me what I'm doing wrong here?
Can you share how you define the actual table for
restaurant
?
createInsertSchema
is a helper to create a zod object. It doesn't create the database schema (not sure if you thought it would).Thank you for your reply. I've defined my schema like this:
Hard to tell what's going on here in the first place, but I'd inspect the
For debugging purposes, try passing a hardcoded object to
newwwRestaurant
object to see if there are any properties missing compared to your restaurant table.For debugging purposes, try passing a hardcoded object to
.values(...)
-- then work on making sure the result from your Zod-parse is identical in shape to that object.
Sorry, hard to debug this for me without looking at all the types that get created at these various steps.Thank you. I noticed that Zod wasn't correctly able to infer the types in my schemas. I had to add
"strict: true"
in my compilerOptions to fix this.