Typescript should not be doing code removal for non TS code · Issue #30525 · microsoft/TypeScript (original) (raw)
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
import foo from 'foo'; export bar from 'bar'; export * as baz from 'baz';
export default class Foobar {}
Expected behavior:
import foo from 'foo'; // why is this line is removed? import _bar from 'bar'; export { _bar as bar }; import * as _baz from 'baz'; export { _baz as baz }; var Foobar = function Foobar() {}; export { Foobar as default };
Actual behavior:
import _bar from 'bar'; export { _bar as bar }; import * as _baz from 'baz'; export { _baz as baz }; export default class Foobar {}
Related Issues:
babel/babel#9723 (comment)