refactor(env.d.ts): ♻️ 完善 Vite 环境变量类型声明
This commit is contained in:
10
src/typings/env.d.ts
vendored
10
src/typings/env.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
/// <reference types="vite/client" />
|
// https://cn.vitejs.dev/guide/env-and-mode
|
||||||
|
|
||||||
declare module "*.vue" {
|
declare module "*.vue" {
|
||||||
import { DefineComponent } from "vue";
|
import { DefineComponent } from "vue";
|
||||||
@@ -7,12 +7,16 @@ declare module "*.vue" {
|
|||||||
export default component;
|
export default component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TypeScript 类型提示都为 string: https://github.com/vitejs/vite/issues/6930
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
/** 应用端口 */
|
/** 应用端口 */
|
||||||
VITE_APP_PORT: string;
|
VITE_APP_PORT: number;
|
||||||
/** API 基础路径 */
|
/** API 基础路径(代理前缀) */
|
||||||
VITE_APP_BASE_API: string;
|
VITE_APP_BASE_API: string;
|
||||||
|
/** API 地址 */
|
||||||
VITE_APP_API_URL: string;
|
VITE_APP_API_URL: string;
|
||||||
|
/** 是否开启 Mock 服务 */
|
||||||
|
VITE_MOCK_DEV_SERVER: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user