index.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // 此文件跟同级目录的 global.d.ts 文件一样也是全局类型声明,只不过这里存放一些零散的全局类型,无需引入直接在 .vue 、.ts 、.tsx 文件使用即可获得类型提示
  2. type RefType<T> = T | null;
  3. type EmitType = (event: string, ...args: any[]) => void;
  4. type TargetContext = "_self" | "_blank";
  5. type ComponentRef<T extends HTMLElement = HTMLDivElement> =
  6. ComponentElRef<T> | null;
  7. type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
  8. type ForDataType<T> = {
  9. [P in T]?: ForDataType<T[P]>;
  10. };
  11. type AnyFunction<T> = (...args: any[]) => T;
  12. type PropType<T> = VuePropType<T>;
  13. type Writable<T> = {
  14. -readonly [P in keyof T]: T[P];
  15. };
  16. type Nullable<T> = T | null;
  17. type NonNullable<T> = T extends null | undefined ? never : T;
  18. type Recordable<T = any> = Record<string, T>;
  19. type ReadonlyRecordable<T = any> = {
  20. readonly [key: string]: T;
  21. };
  22. type Indexable<T = any> = {
  23. [key: string]: T;
  24. };
  25. type DeepPartial<T> = {
  26. [P in keyof T]?: DeepPartial<T[P]>;
  27. };
  28. type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
  29. type Exclusive<T, U> = (Without<T, U> & U) | (Without<U, T> & T);
  30. type TimeoutHandle = ReturnType<typeof setTimeout>;
  31. type IntervalHandle = ReturnType<typeof setInterval>;
  32. type ResponseData<T> = {
  33. code: number;
  34. msg: string;
  35. data: T;
  36. };
  37. type PageDTO<T> = {
  38. total: number;
  39. rows: Array<T>;
  40. };
  41. interface BasePageQuery extends BaseQuery {
  42. pageNum?: number;
  43. pageSize?: number;
  44. }
  45. interface BaseQuery {
  46. beginTime?: string;
  47. endTime?: string;
  48. orderColumn?: string;
  49. orderDirection?: string;
  50. timeRangeColumn?: string;
  51. }
  52. type Effect = "light" | "dark";
  53. interface ChangeEvent extends Event {
  54. target: HTMLInputElement;
  55. }
  56. interface WheelEvent {
  57. path?: EventTarget[];
  58. }
  59. interface ImportMetaEnv extends ViteEnv {
  60. __: unknown;
  61. }
  62. interface Fn<T = any, R = T> {
  63. (...arg: T[]): R;
  64. }
  65. interface PromiseFn<T = any, R = T> {
  66. (...arg: T[]): Promise<R>;
  67. }
  68. interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
  69. $el: T;
  70. }
  71. function parseInt(s: string | number, radix?: number): number;
  72. function parseFloat(string: string | number): number;