JinMao
2022-11-15 908a2fbb3a27d2796a79ccd5576ca4c3a2d372ea
提交 | 用户 | age
a98835 1 import type {
V 2   ComponentRenderProxy,
3   VNode,
1c1755 4   VNodeChild,
a98835 5   ComponentPublicInstance,
V 6   FunctionalComponent,
bb6769 7   PropType as VuePropType,
a98835 8 } from 'vue';
bb6769 9
a98835 10 declare global {
c03056 11   const __APP_INFO__: {
6d6e0a 12     pkg: {
V 13       name: string;
14       version: string;
15       dependencies: Recordable<string>;
16       devDependencies: Recordable<string>;
17     };
18     lastBuildTime: string;
c03056 19   };
d5b768 20   // declare interface Window {
V 21   //   // Global vue app instance
22   //   __APP__: App<Element>;
23   // }
a98835 24
bb6769 25   // vue
V 26   declare type PropType<T> = VuePropType<T>;
1c1755 27   declare type VueNode = VNodeChild | JSX.Element;
bb6769 28
a98835 29   export type Writable<T> = {
V 30     -readonly [P in keyof T]: T[P];
31   };
32
33   declare type Nullable<T> = T | null;
34   declare type NonNullable<T> = T extends null | undefined ? never : T;
35   declare type Recordable<T = any> = Record<string, T>;
36   declare type ReadonlyRecordable<T = any> = {
37     readonly [key: string]: T;
38   };
39   declare type Indexable<T = any> = {
40     [key: string]: T;
41   };
42   declare type DeepPartial<T> = {
43     [P in keyof T]?: DeepPartial<T[P]>;
44   };
45   declare type TimeoutHandle = ReturnType<typeof setTimeout>;
46   declare type IntervalHandle = ReturnType<typeof setInterval>;
47
48   declare interface ChangeEvent extends Event {
49     target: HTMLInputElement;
50   }
51
52   declare interface WheelEvent {
53     path?: EventTarget[];
54   }
55   interface ImportMetaEnv extends ViteEnv {
56     __: unknown;
57   }
58
59   declare interface ViteEnv {
60     VITE_PORT: number;
61     VITE_USE_MOCK: boolean;
62     VITE_USE_PWA: boolean;
63     VITE_PUBLIC_PATH: string;
64     VITE_PROXY: [string, string][];
65     VITE_GLOB_APP_TITLE: string;
66     VITE_GLOB_APP_SHORT_NAME: string;
67     VITE_USE_CDN: boolean;
68     VITE_DROP_CONSOLE: boolean;
69     VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
f7499c 70     VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
a98835 71     VITE_LEGACY: boolean;
V 72     VITE_USE_IMAGEMIN: boolean;
73     VITE_GENERATE_UI: string;
74   }
75
76   declare function parseInt(s: string | number, radix?: number): number;
77
78   declare function parseFloat(string: string | number): number;
79
80   namespace JSX {
81     // tslint:disable no-empty-interface
82     type Element = VNode;
83     // tslint:disable no-empty-interface
84     type ElementClass = ComponentRenderProxy;
85     interface ElementAttributesProperty {
86       $props: any;
87     }
88     interface IntrinsicElements {
89       [elem: string]: any;
90     }
91     interface IntrinsicAttributes {
92       [elem: string]: any;
93     }
94   }
661db0 95 }
V 96
a98835 97 declare module 'vue' {
V 98   export type JSXComponent<Props = any> =
99     | { new (): ComponentPublicInstance<Props> }
100     | FunctionalComponent<Props>;
8ad127 101 }