-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Namespaces fail to merge with enum, w/ misleading error message #11460
Comments
Hey @m93a! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
The problem is that you have two instances of the typescript plugin: the one enabled by CRA, and the one added by you. The one enabled by CRA finds I think the CRA Babel preset supports a |
Hey, EDIT: Isn't it weird that interface+namespace merging works just fine, but enum+namespace doesn't? |
Seems to have been fixed. |
Bug Report
Current Behavior
Set up a TypeScript repository with Babel and plugin-transform-typescript. Add this code:
Input Code
Expected behavior/code
It should compile just fine. In TypeScript this just works: Playground Link
Actual behavior
The compiler throws a very misguiding error:
Changing the order of
enum
andnamespace
declarations results in this error:Babel Configuration
Then add this to
config-overrides.js
:Environment
react-scripts
,webpack
Walkaround
If you need to keep the exact structure in your project, you can do this:
(We can't use a destructuring assignment because of #11461)
Proposed Solution
At least the misleading errors should be fixed as soon as possible. Thinking that the plugin loaded incorrectly caused me a lot of pain and several wasted hours. However, the feature itself is important too and I'd really love to see it implemented.
The text was updated successfully, but these errors were encountered: