Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with optional schemas #9

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

meinlebenswerk
Copy link
Contributor

When a Schema, either built-in or via zod has an optional variable, which results in the validation result being undefined, the corresponding env-variable is set to 'undefined', because of the implicit string conversion via process.env.
This however does not match the types generated for the import.meta.env and is, at least imo, not what I'd expect to happen.

This PR fixes that issue, by unsetting any env-variable, which is undefined after validation and adds tests for this case.
I adapted the test-files slightly to fix any eslint/prettier warnings as well, but we can roll this back again :)

undefined variables are now unset instead of 'undefined'
@Julien-R44
Copy link
Owner

Thanks dude !

@Julien-R44 Julien-R44 merged commit 7bb316c into Julien-R44:main Jun 22, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants