Improve parameter types of the preprocess
and encode
functions in libSquoosh
#1141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As far as I understand, two of the most important functions of our API are
preprocess
andencode
. For them, in #1110, we were taking their types asany
which doesn't provide a good developer experience for a TS developer.This PR adds the concrete types for those function parameters.
In addition to that, default encode options for JXL was not containing some required parameters, so
jxl: {}
was throwing an error. I removed the unrelated parameters and added the ones that is required.I think, after this PR we can expose the types to users and I'll create a PR for that as well :)