Closed
Description
First of all, isolatedModules
seems to imply preserveConstEnums
but it doesn't look like this is documented: https://www.typescriptlang.org/tsconfig#isolatedModules.
Repro:
tsconfig.json
:
{
"compilerOptions": {
"target": "esnext",
"isolatedModules": true
}
}
temp2.ts
:
export const enum a {
b = 1,
c = 2,
};
temp.ts
:
import { a } from "./temp2";
console.log(a.b);
temp2.js
(enum is generated, so preserveConstEnums
is implied?):
export var a;
(function (a) {
a[a["b"] = 1] = "b";
a[a["c"] = 2] = "c";
})(a || (a = {}));
;
temp.js
(the import is left out, even though no inlining is done??):
console.log(a.b);
export {};
This module is invalid and will throw a reference error at runtime. Expected the import from the TS source to be preserved.
I've checked that the same thing will happen with preserveConstEnums
specified explicitly. The equivalent issue occurs without "target": "esnext"
.
Version 3.8.3.