We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e5ab96 commit 1a256c6Copy full SHA for 1a256c6
packages/runtime/src/zod-utils.ts
@@ -121,5 +121,14 @@ function countUnrecognizedKeys(issues: Z.ZodIssue[]) {
121
}
122
123
function unwrapLazy<T extends Z.ZodSchema>(z: typeof Z, schema: T | Z.ZodLazy<T>): T {
124
- return schema instanceof z.ZodLazy ? schema.schema : schema;
+ if (!(schema instanceof z.ZodLazy)) {
125
+ return schema;
126
+ }
127
+ if ('unwrap' in schema && typeof schema.unwrap === 'function') {
128
+ return schema.unwrap();
129
+ } else if ('schema' in schema) {
130
+ return schema.schema as T;
131
+ } else {
132
+ throw new Error('Unable to determine how to unwrap a lazy schema with this zod version.');
133
134
0 commit comments