global.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import type { ComponentRenderProxy, VNode, VNodeChild, PropType as VuePropType } from 'vue';
  2. declare global {
  3. const __APP_INFO__: {
  4. pkg: {
  5. name: string;
  6. version: string;
  7. dependencies: Recordable<string>;
  8. devDependencies: Recordable<string>;
  9. };
  10. lastBuildTime: string;
  11. };
  12. // declare interface Window {
  13. // // Global vue app instance
  14. // __APP__: App<Element>;
  15. // }
  16. // vue
  17. declare type PropType<T> = VuePropType<T>;
  18. declare type VueNode = VNodeChild | JSX.Element;
  19. export type Writable<T> = {
  20. -readonly [P in keyof T]: T[P];
  21. };
  22. declare type Nullable<T> = T | null;
  23. declare type NonNullable<T> = T extends null | undefined ? never : T;
  24. declare type Recordable<T = any> = Record<string, T>;
  25. declare type ReadonlyRecordable<T = any> = {
  26. readonly [key: string]: T;
  27. };
  28. declare type Indexable<T = any> = {
  29. [key: string]: T;
  30. };
  31. declare type DeepPartial<T> = {
  32. [P in keyof T]?: DeepPartial<T[P]>;
  33. };
  34. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  35. declare type IntervalHandle = ReturnType<typeof setInterval>;
  36. declare interface ChangeEvent extends Event {
  37. target: HTMLInputElement;
  38. }
  39. declare interface WheelEvent {
  40. path?: EventTarget[];
  41. }
  42. interface ImportMetaEnv extends ViteEnv {
  43. __: unknown;
  44. }
  45. declare interface ViteEnv {
  46. VITE_USE_MOCK: Boolean;
  47. VITE_USE_ERUDA: Boolean;
  48. }
  49. declare function parseInt(s: string | number, radix?: number): number;
  50. declare function parseFloat(string: string | number): number;
  51. namespace JSX {
  52. // tslint:disable no-empty-interface
  53. type Element = VNode;
  54. // tslint:disable no-empty-interface
  55. type ElementClass = ComponentRenderProxy;
  56. interface ElementAttributesProperty {
  57. $props: any;
  58. }
  59. interface IntrinsicElements {
  60. [elem: string]: any;
  61. }
  62. interface IntrinsicAttributes {
  63. [elem: string]: any;
  64. }
  65. }
  66. }