forked from xiangshu233/vue3-vant4-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.d.ts
77 lines (67 loc) · 2.06 KB
/
global.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type {
ComponentPublicInstance,
FunctionalComponent,
VNodeChild,
PropType as VuePropType,
} from 'vue'
// declare global 在具有 import 或 export 声明全局范围内的事物的文件中使用。
// 这在包含 import 或 export 因为此类文件被视为模块的文件中是必需的,并且在模块中声明的任何内容都在模块范围内。
// 在不是模块的文件中使用 declare global(即不包含import / export)是错误的,因为这样的文件中的所有内容都在全局范围内。
declare global {
const __APP_INFO__: {
pkg: {
name: string
version: string
dependencies: Recordable<string>
devDependencies: Recordable<string>
}
lastBuildTime: string
}
// vue
type PropType<T> = VuePropType<T>
type VueNode = VNodeChild | JSX.Element
export type Writable<T> = {
-readonly [P in keyof T]: T[P];
}
type Nullable<T> = T | null
type NonNullable<T> = T extends null | undefined ? never : T
type Recordable<T = any> = Record<string, T>
interface ReadonlyRecordable<T = any> {
readonly [key: string]: T
}
interface Indexable<T = any> {
[key: string]: T
}
type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>;
}
type TimeoutHandle = ReturnType<typeof setTimeout>
type IntervalHandle = ReturnType<typeof setInterval>
interface ChangeEvent extends Event {
target: HTMLInputElement
}
interface WheelEvent {
path?: EventTarget[]
}
interface ImportMetaEnv extends ViteEnv {
__: unknown
}
interface ViteEnv {
VITE_PORT: number
VITE_USE_MOCK: boolean
VITE_PUBLIC_PATH: string
VITE_GLOB_APP_TITLE: string
VITE_GLOB_APP_SHORT_NAME: string
VITE_DROP_CONSOLE: boolean
VITE_GLOB_PROD_MOCK: boolean
VITE_GLOB_IMG_URL: string
VITE_PROXY: [string, string][]
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
}
}
declare module 'vue' {
export type JSXComponent<Props = any> =
| { new (): ComponentPublicInstance<Props> }
| FunctionalComponent<Props>
}