TypeScript
TypeScript copied to clipboard
incremental compilation does not handle const enum properly
🔎 Search Terms
incremental const enum
🕗 Version & Regression Information
4.9.5
⏯ Playground Link
No response
💻 Code
step1, assume we have the following code a.ts
import {A} from "./c"
let a = A.ONE
b.d.ts
export const enum A {
ONE = 1
}
c.ts
import {A} from "./b"
let b = A.ONE
export {A}
cmdline
tsc --incremental a.ts --tsBuildInfoFile ./buildFile
output a.js
"use strict";
exports.__esModule = true;
var a = 1 /* A.ONE */;
c.js
"use strict";
exports.__esModule = true;
var b = 1 /* A.ONE */;
step2, then modify b.d.ts
export const enum A {
ONE = 2
}
run cmdline
tsc --incremental a.ts --tsBuildInfoFile ./buildFile
step3, modify b.d.ts again
export const enum A {
ONE = 3
}
run cmdline
tsc --incremental a.ts --tsBuildInfoFile ./buildFile
the output is not correct output: a.js
"use strict";
exports.__esModule = true;
var a = 2 /* A.ONE */;
c.js
"use strict";
exports.__esModule = true;
var b = 3 /* A.ONE */
🙁 Actual behavior
output of step3 a.js
"use strict";
exports.__esModule = true;
var a = 2 /* A.ONE */;
c.js
"use strict";
exports.__esModule = true;
var b = 3 /* A.ONE */
🙂 Expected behavior
output of step3 a.js
"use strict";
exports.__esModule = true;
var a = 3 /* A.ONE */;
c.js
"use strict";
exports.__esModule = true;
var b = 3 /* A.ONE */
Additional information about the issue
No response
TypeScript 4.9 is 18 months old - can you please try on latest?
Based on the latest (86a16636cac9599c8752f8588f4b9518860b47ff) of master branch, it still has the same issue
Based on the latest (86a1663) of master branch, it still has the same issue
@RyanCavanaugh please take a look thanks
any update? @RyanCavanaugh @sheetalkamat