global.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 Dictionary<T> = Record<string, T>;
  14. declare type Nullable<T> = T | null;
  15. declare type RefType<T> = T | null;
  16. declare type CustomizedHTMLElement<T> = HTMLElement & T;
  17. declare type Indexable<T = any> = {
  18. [key: string]: T;
  19. };
  20. declare type Hash<T> = Indexable<T>;
  21. declare type DeepPartial<T> = {
  22. [P in keyof T]?: DeepPartial<T[P]>;
  23. };
  24. // type DeepPartial<T> = T extends Function
  25. // ? T
  26. // : T extends object
  27. // ? { [K in keyof T]?: DeepPartial<T[K]> }
  28. // : T;
  29. declare type LabelValueOptions = {
  30. label: string;
  31. value: any;
  32. }[];
  33. declare type EmitType = (event: string, ...args: any[]) => void;
  34. declare type TargetContext = '_self' | '_blank';
  35. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  36. declare type IntervalHandle = ReturnType<typeof setInterval>;
  37. declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
  38. $el: T;
  39. }
  40. declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
  41. declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;