Get in touch

Send an email to: lammers@gmail.com.
Or find me online at: Github, X

Type Node environment variables

Environment variables in Node are available on the process.env object. To add the Typescript types, make sure the Node.js types @types/node are installed and create an environment.d.ts file in which the variables can be declared like this:

declare global {
  namespace NodeJS {
    interface ProcessEnv {
      PORT: string
      LOG_LEVEL: 'error' | 'warning' | 'info'
    }
  }
}

export {}