global.d.ts 1.9 KB

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