-
-
Notifications
You must be signed in to change notification settings - Fork 721
fix(mangler): allow using typescript keywords as variable names #14315
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(mangler): allow using typescript keywords as variable names #14315
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #14315 will degrade performances by 9.24%Comparing Summary
Benchmarks breakdown
Footnotes |
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 a mangler issue by allowing TypeScript keywords like as and any to be used as variable names. The change replaces a custom keyword checking function with the standard oxc_syntax reserved keyword checker, which only prevents mangling of actual JavaScript reserved words rather than TypeScript-specific keywords.
- Replaced custom
is_keywordfunction withoxc_syntax::keyword::is_reserved_keyword - Removed the custom keyword list that incorrectly included TypeScript keywords
- Added oxc_syntax dependency to support the new keyword checking
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_mangler/src/lib.rs | Updated keyword checking logic and removed custom keyword function |
| crates/oxc_mangler/Cargo.toml | Added oxc_syntax dependency for standard keyword checking |
| tasks/minsize/minsize.snap | Updated minification test snapshots reflecting improved mangling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
I'm not sure about the perf regression. Maybe the phf lookup is slower than the |
Merge activity
|
`as`, `any` should be allowed to use as a variable name.
603e004 to
5d3114c
Compare

as,anyshould be allowed to use as a variable name.