Stop using typescript env variables wrong

preview_player
Показать описание

My Products

Useful Links
Рекомендации по теме
Комментарии
Автор

Wow, such a game-changer! Ensuring type safety for environment variables in Next.js is crucial for seamless deployment. Thanks for the tip!

SaaSHuddle
Автор

Thanks for the rec as usual Cody. T3-env has worked well for me in the past

Mrvituhmincguy
Автор

I've seen this around but never dug into it. Just dropped it in a project. Very cool. Nice to see the quick overview. I should have used this sooner.

Stallion
Автор

Did I understood correctly? Using this, if on local you have all variables set it will work, but if in production you have missed for example 1 env variable or mispell it, we will get some error?

kaloyangeorgiev
Автор

What if you add a test in the build process that will test all env variables, and a separate ts file that declare the env variables removing the undefined part. Then when building this test can fail and stop the build process. This would remove the dependence need. And you don't need to import {env}, I know This could be worse development experience but it could have some advantages.

EduarteBDO
Автор

Great video, but this might break tree shaking, for example let's say you have isProd env variable so webpack will replace this env variables true or false and tree shaking will remove some code based on this values.
one major use case if you remember redux :D you can add middlewares for dev but you don't want them in production just an example

alyahmed
Автор

Good video, keep in mind that envs can only be strings, so don't get too carried away with the zod schemas.

roach_iam
Автор

Actually JUST did this type of thing recently. Many projects have limits on getting packages approved so went with a getter for env values, simple check for value and error/log otherwise. Then used the getter for each setting in a config file that the app as a whole uses to reference such values, which allows the config file to be slapped with an interface. That allows us to offset the stack overflow limitations of adding a global d.ts file for ProcessEnv with expected variables.

The real kicker is googling how to do generics for the getter because ain’t nobody memorizes how :P

cloudeater
Автор

can someone tell me his extension theme he is using ?
thanks you

nhatvominh
Автор

Hey, what's the VS Code theme you've got going on?

TeluguBusinessPod
Автор

I usually just create utils file where I define and export object with all env.process strings to then reference them in other files.
Do you think that's smart or not really?

tsykin
Автор

What are you using now instead of t3 stack?

jorgesa
Автор

bro can you guide me is it valuable to learn c# .netcore at this time is it worth it or not ??

Support-Phalestine
Автор

Please tell me What is your vs code theme name? Sir

TeluguBusinessPod
Автор

Wow thank you, I didnt know it existed!

anruntxd
Автор

Great, thank you! I have video topic suggestion: documentation creation.
I'm curious what your insights me be on writing documentation for projects/tools, if that's something you do, and if there are any tools that help you to do so. Thanks!

ewwitsantonio
Автор

Is environment validation in runtime really necessary just to get type inference? I would rather move the env validation to a build step before deploying. Let me know your thoughts. Great work on the consistency!

AneeshSaravuKarekad
Автор

typesafe env vars are great until u forgot to update the env vars for CI and that shit breaks anyway

plusquare
Автор

Cool package, but I don't know about having so much packages inside my project. I already have a lot.

filipfiser
Автор

Does it only work with zod? My project uses valibot.

iiilllii