Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@colinhacks
Copy link
Owner

@colinhacks colinhacks commented Sep 20, 2025

Fixes #5241

@colinhacks colinhacks merged commit 7ffedd0 into main Sep 20, 2025
4 of 5 checks passed
@colinhacks colinhacks deleted the fix-shape-caching branch September 20, 2025 16:38
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on October 3

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

util.assignProp(this, "shape", shape ? util.objectClone(shape) : {});
return this.shape;
},
shape: shape!,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Object Function Shape Parameter Non-Null Assertion Bug

The object function's shape parameter is optional, but the new code uses a non-null assertion (shape!) for assignment. This assigns undefined to def.shape when no shape is provided, unlike the previous getter which defaulted to an empty object. This affects both mini and classic schemas and could cause runtime errors.

Additional Locations (1)

Fix in Cursor Fix in Web

$ZodType.init(inst, def);
// const sh = def.shape;
const desc = Object.getOwnPropertyDescriptor(def, "shape");
if (!desc!.get) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Property Causes Runtime Error

If the 'shape' property is missing from def, Object.getOwnPropertyDescriptor() returns undefined. The non-null assertion desc!.get then attempts to access .get on undefined, which causes a runtime TypeError.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v4]: z.registry size issue while using with recursive object

2 participants