Expose Typescript types in libSquoosh (#1142)

* Expose type declarations in libSquoosh npm package

* Add comment on why we remove the tsbuildinfo

* Fix PreprocessOptions type

Resize should require at least one of the width, height.
The other options are optional for all preprocessors

* Update libSquoosh README to reflect encode changes

I also removed requiring `await image.decoded` call before calling
preprocess or encode since they decode the image before the operation
This commit is contained in:
Ergün Erdoğmuş
2022-02-16 17:19:42 +01:00
committed by GitHub
parent 18b53e2b8a
commit 65ea02627b
5 changed files with 38 additions and 16 deletions

View File

@@ -22,9 +22,10 @@ type EncoderKey = keyof typeof encoders;
type PreprocessorKey = keyof typeof preprocessors;
type PreprocessOptions = {
resize?: ResizeOptions;
quant?: QuantOptions;
rotate?: RotateOptions;
resize?: Partial<Omit<ResizeOptions, 'width' | 'height'>> &
(Pick<ResizeOptions, 'width'> | Pick<ResizeOptions, 'height'>);
quant?: Partial<QuantOptions>;
rotate?: Partial<RotateOptions>;
};
type EncodeResult = {
optionsUsed: object;