Skip to content

TypeScript

Generate TypeScript .d.ts from .env.example.

Installation

NPM version

bash
$ npm i -D @import-meta-env/typescript

Usage

bash
$ npx import-meta-env-typescript -x .env.example

By default, when running above command, the CLI will create an import-meta-env.d.ts file in your project root:

ts
// import-meta-env.d.ts
// Generated by '@import-meta-env/typescript'

interface ImportMetaEnv {
  readonly NAME: string;
}

interface ImportMeta {
  readonly env: ImportMetaEnv;
}

Released under the MIT License.