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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript errors #161

Open
ericehamlin opened this issue Jul 6, 2021 · 2 comments
Open

Typescript errors #161

ericehamlin opened this issue Jul 6, 2021 · 2 comments

Comments

@ericehamlin
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-dropzone-uploader@2.11.0 for the project I'm working on.

When using this library with typescript, there were a couple of errors during compilation resulting from assigning potentially undefined values to typed values.

Here is the diff that solved my problem:

diff --git a/node_modules/react-dropzone-uploader/dist/Dropzone.tsx b/node_modules/react-dropzone-uploader/dist/Dropzone.tsx
index da29a80..4133ead 100644
--- a/node_modules/react-dropzone-uploader/dist/Dropzone.tsx
+++ b/node_modules/react-dropzone-uploader/dist/Dropzone.tsx
@@ -518,8 +518,10 @@ class Dropzone extends React.Component<IDropzoneProps, { active: boolean; dragge
     const formData = new FormData()
     xhr.open(method, url, true)
 
+    // @ts-ignore
     for (const field of Object.keys(fields)) formData.append(field, fields[field])
     xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
+    // @ts-ignore
     for (const header of Object.keys(headers)) xhr.setRequestHeader(header, headers[header])
     fileWithMeta.meta = { ...fileWithMeta.meta, ...extraMeta }
 
@@ -714,6 +716,7 @@ class Dropzone extends React.Component<IDropzoneProps, { active: boolean; dragge
         submitButton={submitButton}
         dropzoneProps={{
           ref: this.dropzone,
+          // @ts-ignore
           className,
           style: style as React.CSSProperties,
           onDragEnter: this.handleDragEnter,

This issue body was partially generated by patch-package.

@prmichaelsen
Copy link

see #108 (comment)

@c0ncentus
Copy link

c0ncentus commented Feb 24, 2023

see #108 (comment)

I look into the code deeply.
I have a "soft ts-compiler" (strict false, null and no strict on null/undefined) and raise big error when delete it.

all "@ts-ignore " is an issue itself because javascript code can works with typescript like this.

im working to make modern dropzone with functions only (working with react v18.2, and will have less feature, I trying to compact the code also) ...
so i'll post my code as alternative ...

I thinking this issue pointing the root of all evil....

PS: maybe at all, i will make real basic dopzone with W3C and MDN content lol : /

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