fix(parser): parse index signature with multiple parameter#11068
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.
Pull Request Overview
This PR enhances the parser to handle index signatures with multiple parameters (emitting an error if more than one is provided), updates diagnostics and codegen formatting, and aligns example code with the new parser API.
- Allow parsing multiple parameters in
ts/types.rsand validate that exactly one is present. - Add a new
index_signature_one_parameterdiagnostic and remove outdated doc comments indiagnostics.rs. - Change codegen to render index signature parameters separated by commas and update examples to match the new parser return type.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_parser/src/ts/types.rs | Use parse_delimited_list for index signature parameters and enforce one parameter. |
| crates/oxc_parser/src/diagnostics.rs | Remove old doc comments and add index_signature_one_parameter. |
| crates/oxc_parser/src/cursor.rs | Simplify loop condition by inlining cur_kind check. |
| crates/oxc_codegen/src/gen.rs | Update index signature parameter separator from ` |
| crates/oxc_codegen/examples/codegen.rs | Adjust example to use Program directly and remove Option. |
Comments suppressed due to low confidence (1)
crates/oxc_parser/src/ts/types.rs:1229
- The call to
parse_delimited_listalready consumes the closing]. The extraexpect(Kind::RBrack)will look for a second]and fail. Please remove this redundantexpect.
self.expect(Kind::RBrack);
CodSpeed Instrumentation Performance ReportMerging #11068 will not alter performanceComparing Summary
|
Merge activity
|
c71e7b9 to
ef72143
Compare

fixes #11052