Closed
Description
Bug Report
My interpretation of the "importsNotUsedAsValues": preserve
option is that the goal is to emit value imports as-is. So that you can rely on the JS emit reflecting the JS you write. Here is a case that seems to violate that.
🔎 Search Terms
importsNotUsedAsValues preserve import binding missing skipped omitted import for side-effects JS+types
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
Playground link with relevant code
💻 Code
// @importsNotUsedAsValues: preserve
// @filename: child.ts
export default 1
// @filename: main.ts
import d from './child'
eval("d");
🙁 Actual behavior
JS emit for main.ts
is missing the import binding.
import './child';
eval("d");
🙂 Expected behavior
The value import should be preserved.
import d from './child';
eval("d");