⚡️ Pro Tip: Supercharge process.env with TypeScript!
Simon Grimm
Visit on X@schlimmson17K followers
11,584 views
⚡️ Pro Tip: Supercharge process.env with TypeScript!
Unlock the power of typed .env files and enjoy seamless code completion in TypeScript. 😱
All you need is a simple environment.d.ts with a few lines of code 👇
8 Comments
Comments from the original post on X (Twitter)

@gyan_boateng
You still have to declare it at two places though. 😅
4 likes

@ahmedbgaiess
Nice but I think it's better to use zod to validate at runtime + have type safery.
3 likes

@passantoscience
works on WebStorm as well 😍 nice one!!!
3 likes

@SheltonLouisX
Or you could use this!
3 likes

@DMProjectsDev
I am using zod, but will give it a try 👍
1 like

@mauwi
Great, thanks a lot!
1 like

@gotnoklu
This is a great tip! But why does adding `export {}` enable the code completion?

@hoh7oht35
Is there any same thing with Golang
