From d986a903b1671749f88710279a6e150a8aa000ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 05:51:44 +0000 Subject: [PATCH 1/2] Initial plan From b13e7e5af59c7012a6f018d6a0741c55b24e9be7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 05:53:33 +0000 Subject: [PATCH 2/2] Add Known Limitations section for namespace import/export Co-authored-by: AntaresQAQ <37372723+AntaresQAQ@users.noreply.github.com> --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 09b9d0d..57d8828 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,47 @@ console.log(HttpStatus.OK); // โ†’ 200 2. **Const Enum Definitions Not Removed**: The plugin only inlines const enum values but does not remove the const enum definitions from the output. To eliminate unused const enum declarations, you should rely on tree-shaking tools (like Rollup or Webpack with `mode: 'production'`) to remove the dead code. +3. **Namespace Import/Export Not Supported**: The plugin cannot inline const enums when they are accessed through namespace imports or re-exported through namespace exports. + + **Not supported - Namespace import:** + + ```typescript + // a.ts + export const enum CE_Test { + X = 1, + Y = 2, + } + + // b.ts + import * as A from "./a"; + const X = A.CE_Test.X; // โŒ Won't be inlined + ``` + + **Not supported - Namespace export/import:** + + ```typescript + // a.ts + export const enum CE_Test { + X = 1, + Y = 2, + } + + // b.ts + export * from "./a"; + + // c.ts + import { CE_Test } from "./b"; + const X = CE_Test.X; // โŒ Won't be inlined, CE_Test is exported by namespace + ``` + + **Workaround**: Use named imports instead: + + ```typescript + // b.ts + import { CE_Test } from "./a"; + const X = CE_Test.X; // โœ… Will be inlined + ``` + ## ๐Ÿงช Testing ```bash