Skip to content

Commit 1a949df

Browse files
fix: Fix optional chaining for innerType in $ZodLazy
1 parent 5e6c0fd commit 1a949df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/zod/src/v4/core/schemas.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,8 +4166,8 @@ export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constru
41664166
util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
41674167
util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
41684168
util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
4169-
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
4170-
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
4169+
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod.optin ?? undefined);
4170+
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod.optout ?? undefined);
41714171
inst._zod.parse = (payload, ctx) => {
41724172
const inner = inst._zod.innerType;
41734173
return inner._zod.run(payload, ctx);

0 commit comments

Comments
 (0)