Skip to content

Commit cd9d58d

Browse files
authored
optimize(types): Enhance compatibility of global types (#494)
1 parent 2198b98 commit cd9d58d

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

src/typings/env.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ declare namespace Env {
105105
readonly VITE_STORAGE_PREFIX?: string;
106106
}
107107
}
108+
109+
interface ImportMeta {
110+
readonly env: Env.ImportMeta;
111+
}

src/typings/global.d.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
interface Window {
2-
/** NProgress instance */
3-
NProgress?: import('nprogress').NProgress;
4-
/** Loading bar instance */
5-
$loadingBar?: import('naive-ui').LoadingBarProviderInst;
6-
/** Dialog instance */
7-
$dialog?: import('naive-ui').DialogProviderInst;
8-
/** Message instance */
9-
$message?: import('naive-ui').MessageProviderInst;
10-
/** Notification instance */
11-
$notification?: import('naive-ui').NotificationProviderInst;
12-
}
1+
export {};
132

14-
interface ViewTransition {
15-
ready: Promise<void>;
16-
}
3+
declare global {
4+
export interface Window {
5+
/** NProgress instance */
6+
NProgress?: import('nprogress').NProgress;
7+
/** Loading bar instance */
8+
$loadingBar?: import('naive-ui').LoadingBarProviderInst;
9+
/** Dialog instance */
10+
$dialog?: import('naive-ui').DialogProviderInst;
11+
/** Message instance */
12+
$message?: import('naive-ui').MessageProviderInst;
13+
/** Notification instance */
14+
$notification?: import('naive-ui').NotificationProviderInst;
15+
}
1716

18-
interface Document {
19-
startViewTransition?: (callback: () => Promise<void> | void) => ViewTransition;
20-
}
17+
export interface Document {
18+
startViewTransition?: (callback: () => Promise<void> | void) => ViewTransition;
19+
}
2120

22-
interface ImportMeta {
23-
readonly env: Env.ImportMeta;
21+
/** Build time of the project */
22+
export const BUILD_TIME: string;
2423
}
2524

26-
/** Build time of the project */
27-
declare const BUILD_TIME: string;
25+
interface ViewTransition {
26+
ready: Promise<void>;
27+
}

0 commit comments

Comments
 (0)