vben
2023-04-05 aedb8e53aa25660b6179389eda0a6b1937bb78fd
提交 | 用户 | 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_USE_MOCK: boolean;
61     VITE_PUBLIC_PATH: string;
62     VITE_PROXY: [string, string][];
63     VITE_GLOB_APP_TITLE: string;
64     VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
65   }
66
67   declare function parseInt(s: string | number, radix?: number): number;
68
69   declare function parseFloat(string: string | number): number;
70
71   namespace JSX {
72     // tslint:disable no-empty-interface
73     type Element = VNode;
74     // tslint:disable no-empty-interface
75     type ElementClass = ComponentRenderProxy;
76     interface ElementAttributesProperty {
77       $props: any;
78     }
79     interface IntrinsicElements {
80       [elem: string]: any;
81     }
82     interface IntrinsicAttributes {
83       [elem: string]: any;
84     }
85   }
661db0 86 }
V 87
a98835 88 declare module 'vue' {
V 89   export type JSXComponent<Props = any> =
90     | { new (): ComponentPublicInstance<Props> }
91     | FunctionalComponent<Props>;
8ad127 92 }