Skip to content

Generate .d.ts file from your .env files for typescript ✨

Notifications You must be signed in to change notification settings

baptistemcn/env-to-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env-to-types

WHAT THE PURPOSE ?

Transform your .env file as input 👌🏻

USER_DATABASE="user"
PASSWORD_DATABASE="password"

And generates a .d.ts file automatically

declare namespace NodeJS {
  export interface ProcessEnv {
    USER_DATABASE: string
    PASSWORD_DATABASE: string
  }
}

Now process.env.USER_DATABASE will autocomplete and SAFE.

USAGE

npx env-to-types path/to/.env

OPTIONS

-v, --version               Show the CLI Version
-h, --help                  Show CLI usage information
-o, --output-type           Output name/path for types files | default will be `env.d.ts`
-e, --env-path-example      Path to save generate .env.example file

EXAMPLE W/ OPTIONS

npx env-to-types .env -o src/types/env.d.ts -e .

About

Generate .d.ts file from your .env files for typescript ✨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published