-
Notifications
You must be signed in to change notification settings - Fork 184
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
Unable to compile with Typescript 4.5.4 #179
Comments
Hi, @GSuggitt have you resolved this issue on your end?? I'm getting the same issue and I haven't reached any solution yet other than setting |
Is there an update on this? Is this project still even active? This seems like such a simple fix that for such a widely used project it should've been fixed by now... no offense intended, but would like to see an update of any kind. |
Note that setting |
I recently upgraded the version of typescript in a react project to version 4.5.4.
When I did this I got an compile error reported in react-dropzone-uploader.
I am using version 2.11.0 of react-dropzone-uploader
In Typescript 4.4 the typing of the catch variable was changed to be "unknown" from "any". As a result the error was reported.
The error I get is:
node_modules/react-dropzone-uploader/dist/Dropzone.tsx:504:44 - error TS2571: Object is of type 'unknown'.
The code in Dropzone.tsx is:
The problem is the catch variable "e" is now typed as "unknown" and so it is an error to attempt to access a member of "unknown"
Typescript has introduced an option "useUnknownInCatchVariables" which when set to "false" will allow the code to compile and that is how I am getting around the problem.
A suggestion has been made to me that I need to wrap my call to react-dropzone-uploader in a try-catch to solve my problem.
That will not solve my issue. My issue is I cannot compile my project.
The person making the suggestion seemed to believe that the try-catch in question was in my code and that I should fix my code.
The problem lies in the Dropzone.tsx file of react-dropzone_uploader. And the fix is very easy:
The text was updated successfully, but these errors were encountered: