Blame view

src/types/global.d.ts 1.49 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
declare function parseFloat(string: string | number): number;

declare type Nullable<T> = T | null;
vben authored
20
21
declare type NonNullable<T> = T extends null | undefined ? never : T;
陈文彬 authored
22
23
24
25
declare type RefType<T> = T | null;

declare type CustomizedHTMLElement<T> = HTMLElement & T;
vben authored
26
declare type Indexable<T extends any = any> = {
陈文彬 authored
27
28
  [key: string]: T;
};
vben authored
29
vben authored
30
31
declare type Recordable<T extends any = any> = Record<string, T>;
vben authored
32
33
34
35
declare type ReadonlyRecordable<T extends any = any> = {
  readonly [key: string]: T;
};
36
declare type Hash<T> = Indexable<T>;
陈文彬 authored
37
38
declare type DeepPartial<T> = {
39
  [P in keyof T]?: DeepPartial<T[P]>;
陈文彬 authored
40
41
};
vben authored
42
declare type LabelValueOptions = {
陈文彬 authored
43
44
45
46
  label: string;
  value: any;
}[];
47
declare type EmitType = (event: string, ...args: any[]) => void;
陈文彬 authored
48
49
declare type TargetContext = '_self' | '_blank';
vben authored
50
51
52
53

declare type TimeoutHandle = ReturnType<typeof setTimeout>;

declare type IntervalHandle = ReturnType<typeof setInterval>;
vben authored
54
55
56
57
58
59
60
61

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>;
vben authored
62
63

type IsSame<A, B> = A | B extends A & B ? true : false;