Skip to content

Commit

Permalink
docs: typing env vars (#4989)
Browse files Browse the repository at this point in the history
Co-authored-by: Shinigami <chrissi92@hotmail.de>
Co-authored-by: Alex Raihelgaus <alex@thesashka.com>
  • Loading branch information
3 people committed Sep 21, 2021
1 parent a85c808 commit 8926c96
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/guide/env-and-mode.md
Expand Up @@ -60,10 +60,14 @@ By default, Vite provides type definition for `import.meta.env`. While you can d
To achieve, you can create an `env.d.ts` in `src` directory, then augment `ImportMetaEnv` like this:

```typescript
interface ImportMetaEnv {
VITE_APP_TITLE: string
interface ImportMetaEnv extends Readonly<Record<string, string>> {
readonly VITE_APP_TITLE: string
// more env variables...
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
```

## Modes
Expand Down

0 comments on commit 8926c96

Please sign in to comment.