2020-04-03 21:21:40 +02:00
|
|
|
interface Document {
|
|
|
|
fonts?: {
|
|
|
|
ready?: Promise<void>;
|
2020-05-08 10:42:51 +02:00
|
|
|
addEventListener?(
|
|
|
|
type: "loading" | "loadingdone" | "loadingerror",
|
|
|
|
listener: (this: Document, ev: Event) => any,
|
|
|
|
): void;
|
2020-04-03 21:21:40 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-01-09 17:37:08 +01:00
|
|
|
interface Window {
|
|
|
|
ClipboardItem: any;
|
2020-10-25 19:39:57 +05:30
|
|
|
__EXCALIDRAW_SHA__: string | undefined;
|
2020-01-09 17:37:08 +01:00
|
|
|
}
|
|
|
|
|
2020-07-02 16:52:58 +01:00
|
|
|
// 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;
|
2020-10-04 11:12:47 -07:00
|
|
|
readonly REACT_APP_FIREBASE_CONFIG: string;
|
2020-07-02 16:52:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-09 17:37:08 +01:00
|
|
|
interface Clipboard extends EventTarget {
|
|
|
|
write(data: any[]): Promise<void>;
|
|
|
|
}
|
2020-03-17 20:55:40 +01:00
|
|
|
|
|
|
|
type Mutable<T> = {
|
|
|
|
-readonly [P in keyof T]: T[P];
|
|
|
|
};
|
2020-03-26 18:28:26 +01:00
|
|
|
|
|
|
|
type ResolutionType<T extends (...args: any) => any> = T extends (
|
|
|
|
...args: any
|
|
|
|
) => Promise<infer R>
|
|
|
|
? R
|
|
|
|
: any;
|
2020-06-06 13:32:43 +02:00
|
|
|
|
|
|
|
// https://github.com/krzkaczor/ts-essentials
|
|
|
|
type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
2020-10-11 21:41:26 +05:30
|
|
|
|
2020-10-13 14:47:07 +02:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2020-10-11 21:41:26 +05:30
|
|
|
// type getter for interface's callable type
|
|
|
|
// src: https://stackoverflow.com/a/58658851/927631
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
|
|
|
|
type CallableType<T extends (...args: any[]) => any> = (
|
|
|
|
...args: SignatureType<T>
|
|
|
|
) => ReturnType<T>;
|
|
|
|
// --------------------------------------------------------------------------—
|
|
|
|
|
|
|
|
// Type for React.forwardRef --- supply only the first generic argument T
|
|
|
|
type ForwardRef<T, P = any> = Parameters<
|
|
|
|
CallableType<React.ForwardRefRenderFunction<T, P>>
|
|
|
|
>[1];
|
2020-10-19 10:53:37 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------—
|
|
|
|
|
|
|
|
interface Blob {
|
|
|
|
handle?: import("browser-nativefs").FileSystemHandle;
|
|
|
|
name?: string;
|
|
|
|
}
|