-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosHelp WantedYou can do thisYou can do this
Milestone
Description
🔎 Search Terms
- isolatedModules
- enum
- cross module
- export
🕗 Version & Regression Information
- This is a crash
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
Test on Playground with version 3.9.7 and version 5.2.2, got the same incorrect result.
⏯ Playground Link
💻 Code
// @showEmit
// @isolatedModules: true
// @filename: foo.ts
export enum Foo {
A = 10
}
// @filename: index.ts
import { Foo } from "./foo";
export enum Bar {
B = Foo.A,
C
}🙁 Actual behavior
Please notice the value of Bar.C
import { Foo } from "./foo";
export var Bar;
(function (Bar) {
Bar[Bar["B"] = 10] = "B";
Bar[Bar["C"] = 11] = "C";
})(Bar || (Bar = {}));🙂 Expected behavior
Emit a warning or an error, and generate code that does not rely on other imports.
Example:
import { Foo } from "./foo";
export var Bar;
(function(Bar) {
Bar[Bar["B"] = Foo.A] = "B";
Bar[Bar["C"] = void 0] = "C";
})(Bar || (Bar = {}));The Bar.C is void 0, since it cannot be refered.
Additional information about the issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosHelp WantedYou can do thisYou can do this