You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since it makes the type-definition less strict, I believe it should be backwards compatible.
The only major issue I see, is that it would not allow zod-config nor any adapter to inspect ZodObject-specific things, for example the shape property. This might be crucial if we want to support #22.
The text was updated successfully, but these errors were encountered:
Hi @dirkluijk! It is not currently supported, you are right. Using z.ZodType<object> to allow usage of Zod effects will bring some other limitations like turning the schema ZodEffects and not a typical Zod Object instance. Let me check later the issues that you created to see if this impacts your end goal :).
Note: Looks like in Zod 4 this will be solved colinhacks/zod#2474, in the mean time if you are using a custom adapter you can wrap your config data in a nested property and this one can be used with effects (e.g. { config: z.object(...).refine(....) })
The current type-definition allows the schema to be only a
z.object()
:How-ever, this means you cannot pass in any other Zod type, e.g. that uses Zod effects like
.transform()
,.preprocesses()
or.refine()
:I believe a more correct type-definition, that maintains the restriction of the config to be an object, would be:
Since it makes the type-definition less strict, I believe it should be backwards compatible.
The only major issue I see, is that it would not allow
zod-config
nor any adapter to inspect ZodObject-specific things, for example theshape
property. This might be crucial if we want to support #22.The text was updated successfully, but these errors were encountered: