- Notifications
You must be signed in to change notification settings - Fork12.9k
Qualify enum member names when referencing in value position#62034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this 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 fixes issue#61944 by ensuring that enum member names are qualified when referenced in value positions during declaration emission. The change prevents TypeScript from emitting invalid unqualified enum member references in declaration files.
Key changes:
- Modified the symbol qualification logic in the type checker to force qualification for enum members in value contexts
- Added a test case to verify the fix works correctly for enum members referenced within namespaces
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/compiler/checker.ts | Updated symbol qualification logic to force qualification for enum members in value contexts |
tests/cases/compiler/invalidUnqualifiedEnum.ts | Added test case with enum and namespace scenario that would previously emit invalid code |
tests/baselines/reference/invalidUnqualifiedEnum.types | Test baseline for type information output |
tests/baselines/reference/invalidUnqualifiedEnum.symbols | Test baseline for symbol resolution output |
tests/baselines/reference/invalidUnqualifiedEnum.js | Test baseline for compiled JavaScript and declaration file output |
Uh oh!
There was an error while loading.Please reload this page.
Fixes#61944
This doesn't have any observable effects (AFAICT) on the forms like
because we never try to declaration emit those in symbolic form - for a literal value of
bar
, they're both= 0
; for a computed value, you don't see the initializer onbaz
at all