refactor(env.d.ts): ♻️ 完善 Vite 环境变量类型声明

This commit is contained in:
hxr 2024-03-10 10:42:57 +08:00
parent e9b13ab327
commit 28c6311139
1 changed files with 7 additions and 3 deletions

10
src/typings/env.d.ts vendored
View File

@ -1,4 +1,4 @@
/// <reference types="vite/client" />
// https://cn.vitejs.dev/guide/env-and-mode
declare module "*.vue" {
import { DefineComponent } from "vue";
@ -7,12 +7,16 @@ declare module "*.vue" {
export default component;
}
// TypeScript 类型提示都为 string https://github.com/vitejs/vite/issues/6930
interface ImportMetaEnv {
/** 应用端口 */
VITE_APP_PORT: string;
/** API 基础路径 */
VITE_APP_PORT: number;
/** API 基础路径(代理前缀) */
VITE_APP_BASE_API: string;
/** API 地址 */
VITE_APP_API_URL: string;
/** 是否开启 Mock 服务 */
VITE_MOCK_DEV_SERVER: boolean;
}
interface ImportMeta {