colinhacks / zod

TypeScript-first schema validation with static type inference
https://zod.dev
MIT License
33.09k stars 1.15k forks source link

fix: use the custom error message correctly #3728

Open sunnylost opened 3 weeks ago

sunnylost commented 3 weeks ago

fix https://github.com/colinhacks/zod/issues/3675

Error messages provided by the user should have the highest priority, so if they exist, they can be used directly.

netlify[bot] commented 3 weeks ago

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit 4b94fbc8a9c7ed35dbeeba672147f8e04fbac92a
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/66cf024412e6d50008e86d63
Deploy Preview https://deploy-preview-3728--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 configuration.

StephanMeijer commented 2 weeks ago

What's the conceptual difference?

sunnylost commented 2 weeks ago

Under this condition if (iss.code !== "invalid_type"), zod won't display user's custom message.