global.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. declare interface Fn<T = any, R = T> {
  2. (...arg: T[]): R;
  3. }
  4. declare interface PromiseFn<T = any, R = T> {
  5. (...arg: T[]): Promise<R>;
  6. }
  7. declare interface IObj<T = any> {
  8. [key: string]: T;
  9. [key: number]: T;
  10. }
  11. declare function parseInt(s: string | number, radix?: number): number;
  12. declare function parseFloat(string: string | number): number;
  13. declare type Nullable<T> = T | null;
  14. declare type NonNullable<T> = T extends null | undefined ? never : T;
  15. declare type RefType<T> = T | null;
  16. declare type CustomizedHTMLElement<T> = HTMLElement & T;
  17. declare type Indexable<T extends any = any> = {
  18. [key: string]: T;
  19. };
  20. declare type Recordable<T extends any = any> = Record<string, T>;
  21. declare type ReadonlyRecordable<T extends any = any> = {
  22. readonly [key: string]: T;
  23. };
  24. declare type Hash<T> = Indexable<T>;
  25. declare type DeepPartial<T> = {
  26. [P in keyof T]?: DeepPartial<T[P]>;
  27. };
  28. declare type LabelValueOptions = {
  29. label: string;
  30. value: any;
  31. }[];
  32. declare type EmitType = (event: string, ...args: any[]) => void;
  33. declare type TargetContext = '_self' | '_blank';
  34. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  35. declare type IntervalHandle = ReturnType<typeof setInterval>;
  36. declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
  37. $el: T;
  38. }
  39. declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
  40. declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
  41. type IsSame<A, B> = A | B extends A & B ? true : false;