export type UploadResult = { signatureURL: string | null; url: string; thumbUrl: string; mime: string; }; export type UploadEventTarget = EventTarget & { promise: Promise; status: 'pending' | 'success' | 'fail'; progress: ProgressEvent | void; data: UploadResult; error: Error | void; ok: () => Promise; addListener(eventName: 'progress', callback: (event: ProgressEvent) => void): () => void; addListener(eventName: 'success', callback: (event: UploadSuccessEvent) => void): () => void; addListener(eventName: 'error', callback: (event: UploadErrorEvent) => void): () => void; }; export type UploadSuccessEvent = CustomEvent; export type UploadErrorEvent = CustomEvent; /** * * 返回一个函数,这个函数可以创建一个UploadEventTarget * * return (file: File, options: ...) => UploadEventTarget */ export declare function useUpload(): (file: File | Blob | string, options?: { category?: 'avatar' | 'caption'; sendRaw?: boolean; }) => UploadEventTarget;