Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript + API rewrite proposition #50

Open
miszo opened this issue Apr 15, 2021 · 3 comments
Open

TypeScript + API rewrite proposition #50

miszo opened this issue Apr 15, 2021 · 3 comments

Comments

@miszo
Copy link

miszo commented Apr 15, 2021

Hi @onurzorluer, for starters I would like to thank you for the lovely library 👍

Is your feature request related to a problem? Please describe.
I have two issues that I would like to address and can even create a PR with it 🙂

  1. Currently, imageSizeResizer method has too many parameters, and it's not the best developer experience you can imagine.
  2. Also, any changes in the method API needs to be also manually changed in types definitions.

Describe the solution you'd like

  1. Refactor imageSizeResizer to take one object argument. It would be easier for developers to use it because they wouldn't need to check the order of the arguments that they need to pass. The exported method would look like this:
export default imageFileResizer: ({
    file,
    maxWidth,
    maxHeight,
    compressFormat,
    quality,
    rotation,
    responseUriFunc,
    outputType,
    minWidth,
    minHeight,
  }) {}
  1. Rewrite solution with typescript. Implementation would stay the same, only with added types, which would be automatically generated in build time, so you don't need to worry about changing them only for the exports. Any changes would come naturally because it would be closer to the library logic.

Please let me know what do you think about the solutions and my contribution towards it.

@onurzorluer
Copy link
Owner

Hello @miszo,
Thanks for your support! We are open to all kinds of contributions.

I know too many parameters is not best case but I could not decide how I solve this. If you want to make PR for this issues, I would be very pleased.

@miszo
Copy link
Author

miszo commented Apr 16, 2021

Hi @onurzorluer, I hope that I get some time this weekend to do it.
I'll send you a PR with this issues addressed :)

@capaj
Copy link

capaj commented Jan 27, 2023

@onurzorluer vscode has a quick action for doing exactly that refactor BTW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants