-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
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");
danieldanielecki, therealstein, lomadurov and nyngwang
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript