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
@babel/plugin-transform-typescript removes regular imports #9723
Comments
Hey @hulkish! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
That is the expected behavior: https://www.typescriptlang.org/play/index.html#src=import%20foo%20from%20'foo'%3B%0A%0Aexport%20default%20class%20Foobar%20%7B%7D In TypeScript, unused imports as considered as type imports and thus removed. |
@nicolo-ribaudo How is this considered safe? What if |
I agree that it is unexpected, but it is a bug with the TypeScript language. We won't diverge from their implementation, so it needs to be fixed upstream first. If you need |
Understood, thanks for the explanation! |
Bug Report
Current Behavior
this logic seems to be introducing a bug for non-typescript code.
Specifically, it is incorrectly removing a regular module import.
Input Code
Expected output
Actual output
Babel Configuration (.babelrc, package.json, cli command)
Environment
@babel/core@7.3.4
,@babel/preset-typescript@7.3.3
npm@
,node@10.15.3
macOS@10.14.1
transformFileSync()
from@babel/core
Possible Solution
Fix issue in
@babel/plugin-transform-typescript
Additional context/Screenshots
N/A
The text was updated successfully, but these errors were encountered: