Blame view

src/types/global.d.ts 1.43 KB
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>;
陈文彬 authored
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
15
陈文彬 authored
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;
30
declare type Indexable<T = any> = {
陈文彬 authored
31
32
  [key: string]: T;
};
vben authored
33
34
declare type Hash<T> = Indexable<T>;
陈文彬 authored
35
36
declare type DeepPartial<T> = {
37
  [P in keyof T]?: DeepPartial<T[P]>;
陈文彬 authored
38
39
};
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
46
declare type LabelValueOptions = {
陈文彬 authored
47
48
49
50
  label: string;
  value: any;
}[];
51
declare type EmitType = (event: string, ...args: any[]) => void;
陈文彬 authored
52
53
declare type TargetContext = '_self' | '_blank';
vben authored
54
55
56
57

declare type TimeoutHandle = ReturnType<typeof setTimeout>;

declare type IntervalHandle = ReturnType<typeof setInterval>;
vben authored
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>;