clddup
2024-07-19 baf406e7e271ac90faa3aec31ceb44715331d9d0
提交 | 用户 | 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
f87e07 25   // fix FullScreen type error
B 26   interface Document {
27     mozFullScreenElement?: Element;
28     msFullscreenElement?: Element;
29     webkitFullscreenElement?: Element;
30   }
31
bb6769 32   // vue
V 33   declare type PropType<T> = VuePropType<T>;
1c1755 34   declare type VueNode = VNodeChild | JSX.Element;
bb6769 35
a98835 36   export type Writable<T> = {
V 37     -readonly [P in keyof T]: T[P];
38   };
39
40   declare type Nullable<T> = T | null;
41   declare type NonNullable<T> = T extends null | undefined ? never : T;
42   declare type Recordable<T = any> = Record<string, T>;
43   declare type ReadonlyRecordable<T = any> = {
44     readonly [key: string]: T;
45   };
46   declare type Indexable<T = any> = {
47     [key: string]: T;
48   };
49   declare type DeepPartial<T> = {
50     [P in keyof T]?: DeepPartial<T[P]>;
51   };
52   declare type TimeoutHandle = ReturnType<typeof setTimeout>;
53   declare type IntervalHandle = ReturnType<typeof setInterval>;
54
55   declare interface ChangeEvent extends Event {
56     target: HTMLInputElement;
57   }
58
59   declare interface WheelEvent {
60     path?: EventTarget[];
61   }
62   interface ImportMetaEnv extends ViteEnv {
63     __: unknown;
64   }
65
66   declare interface ViteEnv {
67     VITE_USE_MOCK: boolean;
68     VITE_PUBLIC_PATH: string;
69     VITE_GLOB_APP_TITLE: string;
70     VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
71   }
72
73   declare function parseInt(s: string | number, radix?: number): number;
74
75   declare function parseFloat(string: string | number): number;
76
77   namespace JSX {
78     // tslint:disable no-empty-interface
79     type Element = VNode;
80     // tslint:disable no-empty-interface
81     type ElementClass = ComponentRenderProxy;
82     interface ElementAttributesProperty {
83       $props: any;
84     }
85     interface IntrinsicElements {
86       [elem: string]: any;
87     }
88     interface IntrinsicAttributes {
89       [elem: string]: any;
90     }
91   }
661db0 92 }
V 93
a98835 94 declare module 'vue' {
V 95   export type JSXComponent<Props = any> =
96     | { new (): ComponentPublicInstance<Props> }
97     | FunctionalComponent<Props>;
8ad127 98 }