-
-
Notifications
You must be signed in to change notification settings - Fork 732
fix(parser): reject invalid modifiers on parameter properties with binding patterns #16083
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(parser): reject invalid modifiers on parameter properties with binding patterns #16083
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. |
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 the TypeScript parser to properly reject parameter properties that use binding patterns (array or object destructuring) instead of simple identifiers. The fix addresses issue #16077 by implementing TypeScript error TS(1187).
Key changes:
- Added validation logic to reject parameter properties with destructuring patterns
- Added comprehensive test cases for both valid and invalid scenarios
- Updated coverage snapshots to reflect the newly passing TypeScript conformance tests
Reviewed changes
Copilot reviewed 2 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/oxc_parser/src/js/function.rs |
Implements validation to reject parameter properties with binding patterns when modifiers (public, private, protected, readonly, override) are present |
crates/oxc_parser/src/diagnostics.rs |
Adds the TS(1187) diagnostic message for invalid parameter property patterns |
tasks/coverage/misc/pass/oxc-16077.ts |
Test cases for valid parameter properties with simple identifiers |
tasks/coverage/misc/fail/oxc-16077.ts |
Test cases for invalid parameter properties with destructuring patterns that should be rejected |
tasks/coverage/snapshots/*.snap |
Updated coverage statistics showing improved TypeScript conformance (6 additional test cases now passing) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
CodSpeed Performance ReportMerging #16083 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
28f865f to
371c7d1
Compare
371c7d1 to
a5ab05e
Compare
a5ab05e to
1199cee
Compare
### 💥 BREAKING CHANGES - 74cf572 ast: [**BREAKING**] Make `source` field of `TSImportType` a `StringLiteral` (#16114) (copilot-swe-agent) - 43156ae ast: [**BREAKING**] Rename `TSImportType` `argument` field to `source` (#16110) (overlookmotel) - 934d873 napi: [**BREAKING**] Drop `armv7-unknown-linux-musleabihf` support (#16105) (Boshen) ### 🚀 Features - 669afe0 ast: Add `Expression::is_jsx` method (#16154) (Dunqing) - 17a8caa parser: Add diagnostic for JSX identifiers with hyphens (#16133) (camchenry) - 0549ae5 parser: Add diagnostic for expected ident after optional chain (#16132) (camchenry) - db839ae parser: Improve diagnostic for unexpected optional declarations (#16131) (camchenry) - bab4bc8 napi/parser: Add type annotations to parse-raw-worker test (#15998) (camc314) ### 🐛 Bug Fixes - 35ed36c traverse: Fix panic when truncating non-ASCII variable names (#16265) (peter) - 9149a26 linter/plugins, napi/parser: Deep freeze visitor keys (#16293) (overlookmotel) - 6b54dab minifier: Incorrect non-null object condition simplification with `&&` and `||` (#16161) (sapphi-red) - 9cc20a1 minifier: Avoid merging side effectful expressions to next assignment statement if the side effect may change the left hand side reference (#16165) (sapphi-red) - 91eb3f2 ast/estree: Convert `TSImportType` `argument` field to `Literal` (#16109) (overlookmotel) - 1199cee parser: Reject invalid modifiers on parameter properties with binding patterns (#16083) (camc314) - f376325 traverse: Remove `console.log` from build script (#16049) (overlookmotel) ### ⚡ Performance - 82d784f lexer: Reduce bounds checks in `Lexer::get_string` (#16317) (overlookmotel) - cc2f352 span: Add `#[inline]` to `Atom` methods (#16311) (overlookmotel) - ffca070 span: Add `#[repr(transparent)]` to `Atom` (#16310) (overlookmotel) - 02bdf90 linter/plugins, napi/parser: Reuse arrays in visitor keys (#16294) (overlookmotel) ### 📚 Documentation - 891e0b4 parser: Add note about falling back to parse TSType in TSImportType (#16119) (camc314) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>

Fixes #16077