diff --git a/src/types.ts b/src/types.ts index f3730ae14..78f0c30e5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2421,7 +2421,7 @@ export class ZodObject< private _cached: { shape: T; keys: string[] } | null = null; _getCached(): { shape: T; keys: string[] } { - if (this._cached !== null) return this._cached; + if (this._cached) return this._cached; const shape = this._def.shape(); const keys = util.objectKeys(shape); return (this._cached = { shape, keys });