mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
perf: 更完善的全局类型提示
This commit is contained in:
87
types/index.d.ts
vendored
87
types/index.d.ts
vendored
@@ -1,33 +1,74 @@
|
||||
declare interface Fn<T = any, R = T> {
|
||||
(...arg: T[]): R;
|
||||
}
|
||||
// 此文件跟同级目录的 global.d.ts 文件一样也是全局类型声明,只不过这里存放一些零散的全局类型,无需引入直接在 .vue 、.ts 、.tsx 文件使用即可获得类型提示
|
||||
|
||||
declare interface PromiseFn<T = any, R = T> {
|
||||
(...arg: T[]): Promise<R>;
|
||||
}
|
||||
type RefType<T> = T | null;
|
||||
|
||||
declare type RefType<T> = T | null;
|
||||
type EmitType = (event: string, ...args: any[]) => void;
|
||||
|
||||
declare type LabelValueOptions = {
|
||||
label: string;
|
||||
value: any;
|
||||
}[];
|
||||
type TargetContext = "_self" | "_blank";
|
||||
|
||||
declare type EmitType = (event: string, ...args: any[]) => void;
|
||||
|
||||
declare type TargetContext = "_self" | "_blank";
|
||||
|
||||
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||
$el: T;
|
||||
}
|
||||
|
||||
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
||||
type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
||||
ComponentElRef<T> | null;
|
||||
|
||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||
type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||
|
||||
declare type ForDataType<T> = {
|
||||
type ForDataType<T> = {
|
||||
[P in T]?: ForDataType<T[P]>;
|
||||
};
|
||||
|
||||
declare type AnyFunction<T> = (...args: any[]) => T;
|
||||
type AnyFunction<T> = (...args: any[]) => T;
|
||||
|
||||
type PropType<T> = VuePropType<T>;
|
||||
|
||||
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]>;
|
||||
};
|
||||
|
||||
type TimeoutHandle = ReturnType<typeof setTimeout>;
|
||||
|
||||
type IntervalHandle = ReturnType<typeof setInterval>;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function parseInt(s: string | number, radix?: number): number;
|
||||
|
||||
function parseFloat(string: string | number): number;
|
||||
|
||||
Reference in New Issue
Block a user