Open michaelsmithxyz opened 5 months ago
I have a very similar issue with "zod": "^3.23.8"
. regardless of the types i'm using in my schema, it is generating each field as optional (even if i don't say .optional()
).
I have a very similar issue with
"zod": "^3.23.8"
. regardless of the types i'm using in my schema, it is generating each field as optional (even if i don't say.optional()
).
Yes same issue for me too with ^3.23.8
Hello! We're working on a project that involves modeling something akin to a generic mutually recursive expression tree with Zod. Here's a simplified example:
This example fails to type check because
NotNode
doesn't satisfy the return type:It seems like the inferred type for
NotNode
typeschild
as optional, which it should not be. I've seen issues similar to this reported here before and for the most part, they've been solved by enabling strict mode, but that doesn't seem to work here. Here's thetsconfig.json
I'm using for this example:and the
package.json
:I've also tried constraining
TBaseSchema
, e.gTBaseSchema extends z.ZodType<object>
. This doesn't seem to affect anything.Is there something incorrect about the way this is being modeled?