No overload matches this call

I'm getting no overload matches this call error (more info on the screenshot).
No description
7 Replies
megamindat
megamindatOP6mo ago
I've defined schema this way:
No description
megamindat
megamindatOP6mo ago
When I do this, I get that error.
No description
megamindat
megamindatOP6mo ago
Hello. Can anyone please tell me what I'm doing wrong here?
samson
samson6mo ago
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).
megamindat
megamindatOP6mo ago
Thank you for your reply. I've defined my schema like this:
No description
samson
samson6mo ago
Hard to tell what's going on here in the first place, but I'd inspect the 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.
megamindat
megamindatOP6mo ago
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.
Want results from more Discord servers?
Add your server