// eslint-disable-next-line @typescript-eslint/no-unused-vars interface Document { fonts?: { ready?: Promise; addEventListener?( type: "loading" | "loadingdone" | "loadingerror", listener: (this: Document, ev: Event) => any, ): void; }; } interface Window { ClipboardItem: any; __EXCALIDRAW_SHA__: string | undefined; } // https://github.com/facebook/create-react-app/blob/ddcb7d5/packages/react-scripts/lib/react-app.d.ts declare namespace NodeJS { interface ProcessEnv { readonly REACT_APP_BACKEND_V1_GET_URL: string; readonly REACT_APP_BACKEND_V2_GET_URL: string; readonly REACT_APP_BACKEND_V2_POST_URL: string; readonly REACT_APP_SOCKET_SERVER_URL: string; readonly REACT_APP_FIREBASE_CONFIG: string; } } interface Clipboard extends EventTarget { write(data: any[]): Promise; } type Mutable = { -readonly [P in keyof T]: T[P]; }; type ResolutionType any> = T extends ( ...args: any ) => Promise ? R : any; // https://github.com/krzkaczor/ts-essentials type MarkOptional = Omit & Partial>; // PNG encoding/decoding // ----------------------------------------------------------------------------- type TEXtChunk = { name: "tEXt"; data: Uint8Array }; declare module "png-chunk-text" { function encode( name: string, value: string, ): { name: "tEXt"; data: Uint8Array }; function decode(data: Uint8Array): { keyword: string; text: string }; } declare module "png-chunks-encode" { function encode(chunks: TEXtChunk[]): Uint8Array; export = encode; } declare module "png-chunks-extract" { function extract(buffer: Uint8Array): TEXtChunk[]; export = extract; } // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // type getter for interface's callable type // src: https://stackoverflow.com/a/58658851/927631 // ----------------------------------------------------------------------------- type SignatureType = T extends (...args: infer R) => any ? R : never; type CallableType any> = ( ...args: SignatureType ) => ReturnType; // --------------------------------------------------------------------------— // Type for React.forwardRef --- supply only the first generic argument T type ForwardRef = Parameters< CallableType> >[1]; // --------------------------------------------------------------------------— interface Blob { handle?: import("browser-nativefs").FileSystemHandle; name?: string; }