Microsoft/TypeScript
Auf GitHub ansehenImport ellision emit bug: usage of imports only in keys of interfaces does not result in those imports being elided as type-only
Open
#58.081 geöffnet am 4. Apr. 2024
BugDomain: JS EmitHelp Wanted
Repository-Metriken
- Stars
- (48.455 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)
Beschreibung
🔎 Search Terms
import ellision emit
🕗 Version & Regression Information
- This is the behavior in every version I tried - I saw it in typescript 4.9 and in the playground in typescript 5.4.3.
⏯ Playground Link
💻 Code
import {BAR} from 'bar';
import * as foo from 'foo';
export interface RootState {
[BAR]: string;
[foo.bar]: string;
}
🙁 Actual behavior
When compiled to ESNext module:
import { BAR } from 'bar';
import * as foo from 'foo';
when compiled to AMD with importHelpers it's interesting that __importStar appears
define(["require", "exports", "tslib", "bar", "foo"], function (require, exports, tslib_1, bar_1, foo) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
foo = tslib_1.__importStar(foo);
});
🙂 Expected behavior
output should be an entirely empty module, e.g. AMD should be
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
ESNext should be
export {}
Additional information about the issue
No response