global.d.ts 2.1 KB

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