-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
TS compilation is broken because of FormData since v10.0.2 #417
Comments
Hmm, ill give it a look! |
Not sure why i dont see this error :/ |
You need a test project that has a different tsconfig I believe |
Not sure how to fix it though. Besides removing the type check :s |
Just removed the reference to @types/form-data since its deprecated anyways. Will test further later |
https://github.com/jdalrymple/example @tiger-seo I tried recreating the error here, but im having no luck :( any suggestions? |
@jdalrymple does it mean i am required to add |
I mean you shouldnt have to since the library is just a dependency. Can you see if you can recreate the error using the example repo? |
@jdalrymple regarding your example, it does compile without error if
|
Just to verify, @tiger-seo if you set the esModuleInterlop=true in YOUR project, this problem goes away? Trying to narrow it down for the issue in the form-data repo |
yes @jdalrymple in this case it goes away |
As I said @jdalrymple the problem is upstream: https://github.com/form-data/form-data/blob/208c367ac28dba36b0275e39f385a5e18229d6f9/lib/form_data.js#L13 you have to fix on this line |
@Casz @jdalrymple The problem is different and not due to form-data. To import the module from another CommonJS module, you would normally use However, trying to use it from an ES6 module isn't that easy and needs a bit of work. For these latter cases, you would use form-data as if it had a default export (which Babel/Webpack 4/Typescript will generate), i.e. That way will you import the class, which you then can construct via It is illegal in ES6 to import the namespace, i.e. node-gitlab is written as an ES6 module with esModuleInterop set (see the tsconfig.json). This is all preamble to understand why node-gitlab has esModuleInterop set. Anyway, node-gitlab uses rollup to create three variants: CommonJS, ES6, (browser) UMD. All use the other Typescript settings, especially esModuleInterop. This results in the boilerplate code (if necessary) to import form-data as if it had a default export. The problem is that the generated type definition files also assume that esModuleInterop is set. So the What happens in this issue is that someone tries to use node-gitlab, but doesn't have esModuleInterop set. So Typescript tries to import the default export from form-data, which doesn't exist (since Typescript didn't generate it). That results in the compile failure. There are two ways of fixing this:
|
@DanielRose Thank you! Ill try your suggestion |
@tiger-seo Give it a try after the latest release is deployed :) |
## [11.0.2](11.0.1...11.0.2) (2019-08-30) ### Bug Fixes * Switching type import to hopefully fix [#417](#417) ([91cfbf2](91cfbf2))
🎉 This issue has been resolved in version 11.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@jdalrymple yes, the issues is fixed, thank you; @DanielRose thanks for detailed explanation ;) |
Description
since version 10.0.2 my build is broken because of FormData, please, see error output below:
i guess this is a regression after #401
Expected behaviour
build success
Actual behaviour
build error
The text was updated successfully, but these errors were encountered: