drizzle-zod createInsertSchema gives optional types
I have the following table:
And I am using
drizzle-zod
to generate a Zod type from my schema:
However when I try to use the type within my tRPC
procedure as such, I get a typescript error, which seems to be complaining that the properties within CreateRecipeSchema
are optional:
I'm quite new to drizzle and zod, and from what I gather from documentation, I am using zod correctly, but I am not sure.6 Replies
Here is the typescript error
👋 I have the correct ouput using your table + zod schema.
Can you share your tsconfig or check you have
"strict": true
in your tsconfig "compilerOptions"
?
I have a similar issue, I changed my tsconfig and still running in to a similar problem
@Musa There is also
strictNullChecks
to set to true
We are tracking every GitHub report to update the documentation. Depending on which template or framework you use, there are many different configurations.This worked. Thanks alot. My bad i asked this question earlier without checking to see if other people had the same issue.
No prob 🫡 and welcome!