-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Typescript should not be doing code removal for non TS code #30525
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Duplicate #9191 and dozens of other issues discussing this |
@RyanCavanaugh Fair enough, however - I landed here after looking to fix this in |
|
But, this doesn't remove the problem of typescript incorrectly doing code removal. |
You can write
if you're depending on the specific identifier being in the file |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Please see babel/babel#9723 (comment)
This code removal is actually unsafe. For example, if
foo
had side effects - how can typescript know its safe to remove the import, without processing that file first? Aka, this is a task for a bundler/compiler.Search Terms:
remove import
,code remove
Code
Expected behavior:
Actual behavior:
Playground Link:
https://www.typescriptlang.org/play/#src=import%20foo%20from%20'foo'%3B%0D%0Aexport%20bar%20from%20'bar'%3B%0D%0Aexport%20*%20as%20baz%20from%20'baz'%3B%0D%0A%0D%0Aexport%20default%20class%20Foobar%20%7B%7D
Related Issues:
babel/babel#9723 (comment)
The text was updated successfully, but these errors were encountered: