global.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import type { RouteMeta as IRouteMeta } from '@vben-core/typings';
  2. import 'vue-router';
  3. declare module 'vue-router' {
  4. // eslint-disable-next-line @typescript-eslint/no-empty-object-type
  5. interface RouteMeta extends IRouteMeta {}
  6. }
  7. export interface JnpfAdminProAppConfigRaw {
  8. VITE_GLOB_API_URL: string;
  9. VITE_GLOB_REPORT_API_URL: string;
  10. VITE_GLOB_WEBSOCKET_URL: string;
  11. }
  12. export interface ApplicationConfig {
  13. apiURL: string;
  14. reportApiURL: string;
  15. webSocketURL: string;
  16. isDevMode: () => boolean;
  17. isProdMode: () => boolean;
  18. }
  19. declare global {
  20. interface Window {
  21. _JNPF_ADMIN_PRO_APP_CONF_: JnpfAdminProAppConfigRaw;
  22. }
  23. namespace JSX {
  24. // tslint:disable no-empty-interface
  25. type Element = VNode;
  26. // tslint:disable no-empty-interface
  27. type ElementClass = ComponentRenderProxy;
  28. interface ElementAttributesProperty {
  29. $props: any;
  30. }
  31. interface IntrinsicElements {
  32. [elem: string]: any;
  33. }
  34. interface IntrinsicAttributes {
  35. [elem: string]: any;
  36. }
  37. }
  38. // vue
  39. declare type PropType<T> = VuePropType<T>;
  40. declare type VueNode = JSX.Element | VNodeChild;
  41. export type Writable<T> = {
  42. -readonly [P in keyof T]: T[P];
  43. };
  44. declare type Nullable<T> = null | T;
  45. declare type NonNullable<T> = T extends null | undefined ? never : T;
  46. declare type Recordable<T = any> = Record<string, T>;
  47. declare type ReadonlyRecordable<T = any> = {
  48. readonly [key: string]: T;
  49. };
  50. declare interface Fn<T = any, R = T> {
  51. (...arg: T[]): R;
  52. }
  53. declare type EmitType = (event: string, ...args: any[]) => void;
  54. }
  55. declare interface Fn<T = any, R = T> {
  56. (...arg: T[]): R;
  57. }
  58. declare interface PromiseFn<T = any, R = T> {
  59. (...arg: T[]): Promise<R>;
  60. }
  61. declare type RefType<T> = null | T;
  62. declare type LabelValueOptions = {
  63. [key: string]: boolean | number | string;
  64. label: string;
  65. value: any;
  66. }[];
  67. declare type TargetContext = '_blank' | '_self';
  68. declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
  69. $el: T;
  70. }
  71. declare type ComponentRef<T extends HTMLElement = HTMLDivElement> =
  72. ComponentElRef<T> | null;
  73. declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;