zod icon indicating copy to clipboard operation
zod copied to clipboard

feat: Add extra coercions

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

This PR adds the following extra coercions:

  1. Set -> Array in ZodArray
  2. Set -> Array in ZodTuple
  3. Array -> Set in ZodSet
  4. Object -> Map in ZodMap
  5. Map -> Object in ZodObject

santosmarco-caribou avatar Dec 22 '22 03:12 santosmarco-caribou

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
Latest commit 3d5eba00ff1572ad0d2e378beafb6205e08563bb
Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/63a3d5714715cc000880eb9c
Deploy Preview https://deploy-preview-1736--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 22 '22 03:12 netlify[bot]

This is interesting but not worth the squeeze, in my opinion. We need to be conservative about what sorts of features make it into core as Zod gets larger, and this use case feels very niche and edge casey. It opens up Zod to a bunch of feature requests of the form "Why isn't there a coercion mode from X to Y?". Keeping z.coerce as primitive-only is the best way to draw a line in the sand.

colinhacks avatar Dec 24 '22 06:12 colinhacks

This is interesting but not worth the squeeze, in my opinion. We need to be conservative about what sorts of features make it into core as Zod gets larger, and this use case feels very niche and edge casey. It opens up Zod to a bunch of feature requests of the form "Why isn't there a coercion mode from X to Y?". Keeping z.coerce as primitive-only is the best way to draw a line in the sand.

Ok, I get what you are saying and agree with the decision.

Closing PR.

santosmarco-caribou avatar Dec 24 '22 06:12 santosmarco-caribou