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

consider allowing string | boolean | undefined for runtimeEnvStrict #14

Closed
stefanprobst opened this issue Apr 25, 2023 · 4 comments
Closed

Comments

@stefanprobst
Copy link
Contributor

when using this package with nuxt to type VITE_ env vars, i am running into the following issue: nuxt types import.meta.env as Record<string, string | boolean | undefined> (see here) - i am guessing because vite sets these default values. however, t3-env enforces runtimeEnvStrict to be Record<string, string | undefined>. would you consider allowing Record<string, string | boolean | undefined> on runtimeEnvStrict to cover this usecase?

@juliusmarminge
Copy link
Member

juliusmarminge commented Apr 25, 2023

That's a strange one - never seen that... environment variables are usually just strings...

I guess it'd fine? Although would love to know why this typedefinition is what it is to begin with, and why they don't use "0" and "1" like everyone else 🤔

@chungweileong94
Copy link
Contributor

From what I can tell, it's no longer the case vitejs/vite#7702 in vite.
There're only two possible reasons I can think of:

  • it's either nuxt team forgot to fix the type.
  • nuxt has some sort of parser for parsing the boolean-like values.

@chungweileong94
Copy link
Contributor

TBH, I don't think it's a bad idea to define the type as any, since it has runtimeEnv config, which means the value can be anything other than process.env, plus it's all about zod validation anyway.

@juliusmarminge
Copy link
Member

i guess

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

No branches or pull requests

3 participants