You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.6 KiB

  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 TimeoutHandle = ReturnType<typeof setTimeout>;
  29. type IntervalHandle = ReturnType<typeof setInterval>;
  30. type Effect = "light" | "dark";
  31. interface ChangeEvent extends Event {
  32. target: HTMLInputElement;
  33. }
  34. interface WheelEvent {
  35. path?: EventTarget[];
  36. }
  37. interface ImportMetaEnv extends ViteEnv {
  38. __: unknown;
  39. }
  40. interface Fn<T = any, R = T> {
  41. (...arg: T[]): R;
  42. }
  43. interface PromiseFn<T = any, R = T> {
  44. (...arg: T[]): Promise<R>;
  45. }
  46. interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
  47. $el: T;
  48. }
  49. function parseInt(s: string | number, radix?: number): number;
  50. function parseFloat(string: string | number): number;