vben
authored
5 years ago
1
2
3
4
5
6
declare interface Fn<T = any, R = T> {
(...arg: T[]): R;
}
declare interface PromiseFn<T = any, R = T> {
(...arg: T[]): Promise<R>;
7
8
9
10
11
12
13
14
}
declare interface IObj<T = any> {
[key: string]: T;
[key: number]: T;
}
declare function parseInt(s: string | number, radix?: number): number;
vben
authored
5 years ago
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
declare function parseFloat(string: string | number): number;
declare type Dictionary<T> = Record<string, T>;
declare type Nullable<T> = T | null;
declare type RefInstanceType<T> = {
$: T;
} | null;
declare type RefType<T> = T | null;
declare type CustomizedHTMLElement<T> = HTMLElement & T;
vben
authored
5 years ago
30
declare type Indexable<T = any> = {
31
32
[key: string]: T;
};
vben
authored
5 years ago
33
vben
authored
5 years ago
34
declare type Hash<T> = Indexable<T>;
35
vben
authored
5 years ago
36
declare type DeepPartial<T> = {
vben
authored
5 years ago
37
[P in keyof T]?: DeepPartial<T[P]>;
38
39
};
vben
authored
5 years ago
40
41
42
43
44
45
// type DeepPartial<T> = T extends Function
// ? T
// : T extends object
// ? { [K in keyof T]?: DeepPartial<T[K]> }
// : T;
vben
authored
5 years ago
46
declare type LabelValueOptions = {
47
48
49
50
label: string;
value: any;
}[];
vben
authored
5 years ago
51
declare type EmitType = (event: string, ...args: any[]) => void;
52
vben
authored
5 years ago
53
declare type TargetContext = '_self' | '_blank';
vben
authored
5 years ago
54
55
56
57
declare type TimeoutHandle = ReturnType<typeof setTimeout>;
declare type IntervalHandle = ReturnType<typeof setInterval>;
vben
authored
5 years ago
58
59
60
61
62
63
64
65
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
$el: T;
}
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;