zod icon indicating copy to clipboard operation
zod copied to clipboard

feat: add index signature inference when using `passthrough` on ZodObjects

Open santosmarco-caribou opened this issue 2 years ago • 2 comments

Overview

As we know, the passthrough option allows any key to, as the name suggests, pass through the parser.

This PR adds a { [k: string] any } index signature on the Zod Objects marked as passthrough. (because that's what happens in reality, right?)

If you declare a catchall, though, the catchall has priority over it (as says the docs and the code) so the inference caused by the passthrough option goes away.

Screenshot 2022-12-13 at 2 26 50 PM

santosmarco-caribou avatar Dec 13 '22 17:12 santosmarco-caribou

Deploy Preview for guileless-rolypoly-866f8a failed.

Built without sensitive environment variables

Name Link
Latest commit 9bd4e14db822dfdadbc0ce801eae50413002702f
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/6398b5f0e63dde00091b71f7

netlify[bot] avatar Dec 13 '22 17:12 netlify[bot]

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit 9aafad8022c85fa3b518033cb3718fcdf20babd9
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/639bb63e35bbea0009c7deb0
Deploy Preview https://deploy-preview-1688--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 13 '22 17:12 netlify[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 10 '23 00:05 stale[bot]