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 :)
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 :)