2022-11-26 19:14:08 +08:00
|
|
|
// 此文件跟同级目录的 global.d.ts 文件一样也是全局类型声明,只不过这里存放一些零散的全局类型,无需引入直接在 .vue 、.ts 、.tsx 文件使用即可获得类型提示
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type RefType<T> = T | null;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type EmitType = (event: string, ...args: any[]) => void;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type TargetContext = "_self" | "_blank";
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
|
|
|
ComponentElRef<T> | null;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type ForDataType<T> = {
|
|
|
|
[P in T]?: ForDataType<T[P]>;
|
|
|
|
};
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type AnyFunction<T> = (...args: any[]) => T;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type PropType<T> = VuePropType<T>;
|
2021-10-16 16:16:58 +08:00
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
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>;
|
|
|
|
|
|
|
|
type ReadonlyRecordable<T = any> = {
|
|
|
|
readonly [key: string]: T;
|
|
|
|
};
|
|
|
|
|
|
|
|
type Indexable<T = any> = {
|
|
|
|
[key: string]: T;
|
|
|
|
};
|
|
|
|
|
|
|
|
type DeepPartial<T> = {
|
|
|
|
[P in keyof T]?: DeepPartial<T[P]>;
|
2021-10-16 16:16:58 +08:00
|
|
|
};
|
|
|
|
|
2023-06-05 15:44:49 +08:00
|
|
|
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
|
|
|
|
|
|
|
type Exclusive<T, U> = (Without<T, U> & U) | (Without<U, T> & T);
|
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
type TimeoutHandle = ReturnType<typeof setTimeout>;
|
|
|
|
|
|
|
|
type IntervalHandle = ReturnType<typeof setInterval>;
|
|
|
|
|
2022-12-02 20:20:50 +08:00
|
|
|
type Effect = "light" | "dark";
|
|
|
|
|
2022-11-26 19:14:08 +08:00
|
|
|
interface ChangeEvent extends Event {
|
|
|
|
target: HTMLInputElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface WheelEvent {
|
|
|
|
path?: EventTarget[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ImportMetaEnv extends ViteEnv {
|
|
|
|
__: unknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Fn<T = any, R = T> {
|
|
|
|
(...arg: T[]): R;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PromiseFn<T = any, R = T> {
|
|
|
|
(...arg: T[]): Promise<R>;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
|
|
|
$el: T;
|
|
|
|
}
|
|
|
|
|
2024-05-18 01:11:46 +08:00
|
|
|
// function parseInt(s: string | number, radix?: number): number;
|
2022-11-26 19:14:08 +08:00
|
|
|
|
2024-05-18 01:11:46 +08:00
|
|
|
// function parseFloat(string: string | number): number;
|