docs: add namespace import/export limitation to README#10
Conversation
Co-authored-by: AntaresQAQ <37372723+AntaresQAQ@users.noreply.github.com>
|
@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? |
There was a problem hiding this comment.
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.
|
|
||
| // c.ts | ||
| import { CE_Test } from "./b"; | ||
| const X = CE_Test.X; // ❌ Won't be inlined, CE_Test is exported by namespace |
There was a problem hiding this comment.
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.
| 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 |
| export * from "./a"; | ||
|
|
||
| // c.ts | ||
| import { CE_Test } from "./b"; |
There was a problem hiding this comment.
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.
The plugin cannot inline const enums accessed through namespace imports (
import * as) or namespace exports (export *). This limitation was undocumented.Changes
import * as A from "./a"followed byA.CE_Test.Xexport * from "./a"preventing inlining in downstream importsExample
Not inlined:
Inlined (workaround):
Original prompt
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.