diff --git a/libsquoosh/src/index.ts b/libsquoosh/src/index.ts index bfd3bac1..cc4fe1af 100644 --- a/libsquoosh/src/index.ts +++ b/libsquoosh/src/index.ts @@ -26,6 +26,12 @@ type PreprocessOptions = { quant?: QuantOptions; rotate?: RotateOptions; }; +type EncodeResult = { + optionsUsed: object; + binary: Uint8Array; + extension: string; + size: number; +}; async function decodeFile({ file, @@ -83,7 +89,7 @@ async function encodeImage({ encConfig: any; optimizerButteraugliTarget: number; maxOptimizerRounds: number; -}) { +}): Promise { let binary: Uint8Array; let optionsUsed = encConfig; const encoder = await encoders[encName].enc(); @@ -172,7 +178,7 @@ class Image { public file: ArrayBuffer | ArrayLike; public workerPool: WorkerPool; public decoded: Promise<{ bitmap: ImageData }>; - public encodedWith: { [key: string]: any }; + public encodedWith: { [key in EncoderKey]?: Promise }; constructor( workerPool: WorkerPool,