zod icon indicating copy to clipboard operation
zod copied to clipboard

fix: [#1693] Tuple with empty items

Open metuan opened this issue 2 years ago • 1 comments

map() as referenced in MDN is is invoked only for array indexes which have assigned values. It is not invoked for empty slots in sparse arrays.

In some cases, these slots behave as undefined (that would be caught by existing implementation) but in others (e.g. array iteration methods), empty slots are skipped. More info here.

Destructing will result in usage of property enumeration instead of iterator which should fix this issue.

Screenshot for reference. Screenshot 2022-12-17 at 00 19 40

Fixes both: ZodTuple and ZodArray. Reported in #1693

metuan avatar Dec 16 '22 23:12 metuan

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit 0aaebaae11b919323e633d5ecf2ab691507b8e11
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/639d14a4552e4e0009b36c55
Deploy Preview https://deploy-preview-1712--guileless-rolypoly-866f8a.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Dec 16 '22 23:12 netlify[bot]

Gotta love JavaScript. Thanks!

colinhacks avatar Dec 24 '22 08:12 colinhacks