-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.d.ts
27 lines (22 loc) · 820 Bytes
/
env.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/// <reference types="vite/client" />
/// <reference types="unplugin-vue2-script-setup/shims" />
/*
### IntelliSense
By default, Vite provides type definition for `import.meta.env`.
While you can define more custom env variables in `.env.[mode]` files,
you may want to get TypeScript IntelliSense for user-defined env variables
which prefixed with `VITE_`. <-- !Important!
To achieve, you can create an `env.d.ts` in `src` directory, then augment `ImportMetaEnv` like this:
interface ImportMetaEnv {
VITE_APP_TITLE: string
// more env variables...
}
*/
interface ImportMetaEnv extends Readonly<Record<string, string>> {
readonly VITE_BASE_BACKEND_URL?: string;
readonly VITE_BASE_POKEAPI?: string;
// more env variables...
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}