This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

tyenv
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

tyenv

NPM version Package Build Coverage Status

An utility for creation types for process.env variables and .env file.

Installation

npm i tyenv

Initial types generation

At the very first time you will have to create a env.d.ts file. It will be located at node_modules/tyenv/lib directory and will include all types for process.env and .env file.

Note

If .env file was updated - this script should be re-run manually to get all new variables with types for your development process.

Add following script to the scripts of your project's package.json file:

"tyenv": "tyenv init"

Then run:

npm run tyenv

Usage

Add import:

// ES6 or TypeScript
import env from 'tyenv';

// CommonJS
const { env } = require('tyenv');

All of the process.env and the .env file variables will be available with types:

'.env' example

# This value will have a 'number' type.
PORT=3000

# This value will have a 'string' type. Quotes ' or " will be removed.
PROJECT='foo-bar'

COMMENT=some-comment # This value will have a 'string' type and this comment will be removed.

# This value will have a 'boolean' type.
IS_JSON=true

Package Sidebar

Install

npm i tyenv

Weekly Downloads

1

Version

1.2.2

License

MIT

Unpacked Size

7.64 kB

Total Files

8

Last publish

Collaborators

  • andr-ll