1.0.0 • Published 3 years ago
env-declaration v1.0.0
Generate your .env file to type declarations
Installation
npm install --save-dev typed-envor
yarn add -D typed-envCommand
env-types <env-file> <file-name>arg file-name is optional
Example command
env-types .env.local my-envthis command will generate file from .env.local to my-env.d.ts in main directory
Example .env file :
DB_NAME=test
DB_URL=testExample content of env.d.ts
export {};
declare global {
namespace NodeJS {
interface ProcessEnv {
DB_NAME: string;
DB_URL: string;
}
}
}if env suggestion doesn’t appear, try add this in array of include property in tsconfig.json
"/**/*.d.ts";1.0.0
3 years ago