You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Zod heavily for parsing environment variables and in each project need to reimplement transformer definitions to convert the raw env object (either from process.env or dotenv) to their intended types.
What would alleviate a bunch of pain in this use case is having built in <number|boolean|bigint|null>String(), for example:
To me this looks more like something that could/should be implemented by a utility library. You could even include the schema itself in it, by using it like z.preprocess(...castToBoolean), so it’d really not be a lot of added code if this isn’t in zod itself.
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.
I use Zod heavily for parsing environment variables and in each project need to reimplement transformer definitions to convert the raw env object (either from
process.env
ordotenv
) to their intended types.What would alleviate a bunch of pain in this use case is having built in
<number|boolean|bigint|null>String()
, for example:The ideal implementation would be for the
z
import to provide these like:Happy to do an MR if this is something that might be accepted?
The text was updated successfully, but these errors were encountered: