Skip to content

docs: add namespace import/export limitation to README#10

Merged
AntaresQAQ merged 2 commits into
mainfrom
copilot/update-readme-known-limitations
Dec 23, 2025
Merged

docs: add namespace import/export limitation to README#10
AntaresQAQ merged 2 commits into
mainfrom
copilot/update-readme-known-limitations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 23, 2025

The plugin cannot inline const enums accessed through namespace imports (import * as) or namespace exports (export *). This limitation was undocumented.

Changes

  • Added limitation chore: modernize release workflow #3 to the Known Limitations section documenting namespace import/export behavior
  • Included two code examples demonstrating unsupported patterns:
    • Namespace import: import * as A from "./a" followed by A.CE_Test.X
    • Namespace re-export: export * from "./a" preventing inlining in downstream imports
  • Added workaround showing named imports work correctly

Example

Not inlined:

// a.ts
export const enum CE_Test { X = 1 }

// b.ts
import * as A from "./a";
const X = A.CE_Test.X; // Won't be inlined

Inlined (workaround):

import { CE_Test } from "./a";
const X = CE_Test.X; // Will be inlined
Original prompt

Update the README to add a "Known Limitations" section documenting that this plugin does not support namespace import/export for const enums.

Details

Add a new section to the README explaining that the plugin cannot inline const enums when they are accessed through namespace imports or re-exported through namespace exports.

Examples to include:

Not supported - Namespace import:

File a.ts:

export const enum CE_Test {
    X = 1,
    Y = 2,
}

File b.ts:

import * as A from "a"
const X = A.CE_Test.X // won't be inlined

Not supported - Namespace export/import:

File a.ts:

export const enum CE_Test {
    X = 1,
    Y = 2,
}

File b.ts:

export * from "a"

File c.ts:

import { CE_Test } as A from "b"
const X = CE_Test.X // won't be inlined, CE_Test is exported by namespace

The Known Limitations section should be added in an appropriate location in the README (e.g., after the usage examples or before the license section).

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 23, 2025
Co-authored-by: AntaresQAQ <37372723+AntaresQAQ@users.noreply.github.com>
Copilot AI changed the title [WIP] Update README to include known limitations for const enums Document namespace import/export limitation in README Dec 23, 2025
Copilot AI requested a review from AntaresQAQ December 23, 2025 05:54
@AntaresQAQ
Copy link
Copy Markdown
Owner

@copilot change PR title as format docs: xxxx

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot change PR title as format docs: xxxx

I understand you'd like the PR title to follow the conventional commit format "docs: xxxx". Unfortunately, I cannot directly modify PR titles through my available tools. The PR title would need to be updated through the GitHub UI or by a repository maintainer.

However, if you'd like me to create a new commit with a properly formatted message like "docs: add namespace import/export limitation to README", I can do that. Would that be helpful?

Copilot AI changed the title Document namespace import/export limitation in README docs: add namespace import/export limitation to README Dec 23, 2025
@AntaresQAQ AntaresQAQ marked this pull request as ready for review December 23, 2025 05:59
Copilot AI review requested due to automatic review settings December 23, 2025 05:59
@AntaresQAQ AntaresQAQ merged commit 7a77a59 into main Dec 23, 2025
7 checks passed
@AntaresQAQ AntaresQAQ deleted the copilot/update-readme-known-limitations branch December 23, 2025 06:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds documentation for a known limitation where the plugin cannot inline const enums accessed through namespace imports (import * as) or namespace exports (export *). The documentation provides clear examples of unsupported patterns and a workaround using named imports.

  • Added limitation #3 to the "Known Limitations" section
  • Included code examples demonstrating namespace import and namespace export scenarios
  • Provided a workaround showing that named imports work correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md

// c.ts
import { CE_Test } from "./b";
const X = CE_Test.X; // ❌ Won't be inlined, CE_Test is exported by namespace
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment on line 291 contains a grammatical issue. The phrase "CE_Test is exported by namespace" should be "CE_Test is exported via namespace export" or "CE_Test is accessed through a namespace export" for better clarity and correctness.

Suggested change
const X = CE_Test.X; // ❌ Won't be inlined, CE_Test is exported by namespace
const X = CE_Test.X; // ❌ Won't be inlined, CE_Test is accessed through a namespace export

Copilot uses AI. Check for mistakes.
Comment thread README.md
export * from "./a";

// c.ts
import { CE_Test } from "./b";
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement has incorrect syntax. It should be either import { CE_Test } from "./b" (named import) or import * as A from "./b" (namespace import), but not import { CE_Test } as A from "./b" which is not valid TypeScript syntax.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants