global.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. interface Document {
  2. fonts?: {
  3. ready?: Promise<void>;
  4. addEventListener?(
  5. type: "loading" | "loadingdone" | "loadingerror",
  6. listener: (this: Document, ev: Event) => any,
  7. ): void;
  8. };
  9. }
  10. interface Window {
  11. ClipboardItem: any;
  12. __EXCALIDRAW_SHA__: string;
  13. }
  14. // https://github.com/facebook/create-react-app/blob/ddcb7d5/packages/react-scripts/lib/react-app.d.ts
  15. declare namespace NodeJS {
  16. interface ProcessEnv {
  17. readonly REACT_APP_BACKEND_V1_GET_URL: string;
  18. readonly REACT_APP_BACKEND_V2_GET_URL: string;
  19. readonly REACT_APP_BACKEND_V2_POST_URL: string;
  20. readonly REACT_APP_SOCKET_SERVER_URL: string;
  21. }
  22. }
  23. interface Clipboard extends EventTarget {
  24. write(data: any[]): Promise<void>;
  25. }
  26. type Mutable<T> = {
  27. -readonly [P in keyof T]: T[P];
  28. };
  29. type ResolutionType<T extends (...args: any) => any> = T extends (
  30. ...args: any
  31. ) => Promise<infer R>
  32. ? R
  33. : any;
  34. // https://github.com/krzkaczor/ts-essentials
  35. type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;