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

fix: ensure proper readonly arrays for types #1280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pcorpet
Copy link

@pcorpet pcorpet commented Mar 17, 2023

What kind of change does this PR introduce?

  • Bug Fix

Did you add tests for your changes?

  • Yes, my code is well tested

If relevant, did you update the documentation?

  • Not relevant

Summary
In Typescript, by default arrays are mutable, that means that passing an array of string to a component would allow the component to change this array by adding or removing values. This is not the intention of react-dropzone. It also allows to use const arrays (see in the test) as props which is good practice when using stable props to ensure better React performance.

Does this PR introduce a breaking change?
No, I have only used compatible types. Any previous usage would work as such, and new usage would now work.

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

Successfully merging this pull request may close these issues.

None yet

1 participant