Closed nicobao closed 9 months ago
@Julien-R44 Yes, this kills the usefulness of this plugin, because the types reported by the schema are a lie.
env
is still Record<string, string>
https://github.com/Julien-R44/vite-plugin-validate-env/blob/main/src/validators/zod/index.ts#L21
Any way to actually store the correct type after transformation/preprocessing?
Hey! Sorry for taking so long. This is now fixed with 1.0.0
https://github.com/Julien-R44/vite-plugin-validate-env/releases/tag/v1.0.0
Hi!
Thanks for the lib. I tried to transform my config param string
"acme.com, example.com"
to an array of string:["acme.com", "example.com"]
with zod and this lib. Typescript and my IDE say it works, buttypeof import.meta.env.VITE_AUTHORIZED_FQDNS
returnsstring
andimport.meta.env.VITE_AUTHORIZED_FQDNS
is the original config string :/Here is the latest config I tried from
env.ts
:I tried also with transform + refine - no luck.