vue-pure-admin2/types/global.d.ts

103 lines
2.7 KiB
TypeScript
Raw Normal View History

2021-04-14 16:44:58 +08:00
import type {
ComponentRenderProxy,
VNode,
ComponentPublicInstance,
FunctionalComponent,
2021-07-20 17:16:42 +08:00
PropType as VuePropType
2021-04-20 14:33:07 +08:00
} from "vue";
2021-04-14 16:44:58 +08:00
declare global {
const __APP_INFO__: {
pkg: {
2021-04-20 14:33:07 +08:00
name: string;
version: string;
dependencies: Recordable<string>;
devDependencies: Recordable<string>;
};
lastBuildTime: string;
};
2021-09-17 10:29:59 +08:00
interface Window {
2021-04-14 16:44:58 +08:00
// Global vue app instance
2021-04-20 14:33:07 +08:00
__APP__: App<Element>;
2021-09-17 10:29:59 +08:00
webkitCancelAnimationFrame: (handle: number) => void;
2021-09-18 22:24:52 +08:00
mozCancelAnimationFrame: (handle: number) => void;
oCancelAnimationFrame: (handle: number) => void;
msCancelAnimationFrame: (handle: number) => void;
2021-09-17 10:29:59 +08:00
webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
2021-09-18 22:24:52 +08:00
mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
2021-04-14 16:44:58 +08:00
}
// vue
2021-09-17 10:29:59 +08:00
type PropType<T> = VuePropType<T>;
2021-04-14 16:44:58 +08:00
2021-09-17 10:29:59 +08:00
type Writable<T> = {
2021-04-20 14:33:07 +08:00
-readonly [P in keyof T]: T[P];
};
2021-04-14 16:44:58 +08:00
2021-09-17 10:29:59 +08:00
type Nullable<T> = T | null;
type NonNullable<T> = T extends null | undefined ? never : T;
type Recordable<T = any> = Record<string, T>;
type ReadonlyRecordable<T = any> = {
2021-04-20 14:33:07 +08:00
readonly [key: string]: T;
};
2021-09-17 10:29:59 +08:00
type Indexable<T = any> = {
2021-04-20 14:33:07 +08:00
[key: string]: T;
};
2021-09-17 10:29:59 +08:00
type DeepPartial<T> = {
2021-04-20 14:33:07 +08:00
[P in keyof T]?: DeepPartial<T[P]>;
};
2021-09-17 10:29:59 +08:00
type TimeoutHandle = ReturnType<typeof setTimeout>;
type IntervalHandle = ReturnType<typeof setInterval>;
2021-04-14 16:44:58 +08:00
2021-09-17 10:29:59 +08:00
interface ChangeEvent extends Event {
2021-04-20 14:33:07 +08:00
target: HTMLInputElement;
2021-04-14 16:44:58 +08:00
}
2021-09-17 10:29:59 +08:00
interface WheelEvent {
2021-04-20 14:33:07 +08:00
path?: EventTarget[];
2021-04-14 16:44:58 +08:00
}
interface ImportMetaEnv extends ViteEnv {
2021-04-20 14:33:07 +08:00
__: unknown;
2021-04-14 16:44:58 +08:00
}
declare interface ViteEnv {
2021-04-20 14:33:07 +08:00
VITE_PORT: number;
VITE_USE_MOCK: boolean;
VITE_USE_PWA: boolean;
VITE_PUBLIC_PATH: string;
VITE_PROXY: [string, string][];
VITE_GLOB_APP_TITLE: string;
VITE_GLOB_APP_SHORT_NAME: string;
VITE_USE_CDN: boolean;
VITE_DROP_CONSOLE: boolean;
VITE_BUILD_COMPRESS: "gzip" | "brotli" | "none";
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
VITE_LEGACY: boolean;
VITE_USE_IMAGEMIN: boolean;
VITE_GENERATE_UI: string;
2021-04-14 16:44:58 +08:00
}
2021-09-17 10:29:59 +08:00
function parseInt(s: string | number, radix?: number): number;
2021-04-14 16:44:58 +08:00
2021-09-17 10:29:59 +08:00
function parseFloat(string: string | number): number;
2021-04-14 16:44:58 +08:00
namespace JSX {
// tslint:disable no-empty-interface
2021-04-20 14:33:07 +08:00
type Element = VNode;
2021-04-14 16:44:58 +08:00
// tslint:disable no-empty-interface
2021-04-20 14:33:07 +08:00
type ElementClass = ComponentRenderProxy;
2021-04-14 16:44:58 +08:00
interface ElementAttributesProperty {
2021-04-20 14:33:07 +08:00
$props: any;
2021-04-14 16:44:58 +08:00
}
interface IntrinsicElements {
2021-04-20 14:33:07 +08:00
[elem: string]: any;
2021-04-14 16:44:58 +08:00
}
interface IntrinsicAttributes {
2021-04-20 14:33:07 +08:00
[elem: string]: any;
2021-04-14 16:44:58 +08:00
}
}
}