fix(parser): respect optional TSNamedTupleMember for ts error 1266 &1257#18178
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 Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR fixes TypeScript parser errors 1266 and 1257 by properly handling the optional field of TSNamedTupleMember when validating tuple element ordering constraints.
Changes:
- Updated tuple type parsing logic to respect the
optionalfield onTSNamedTupleMemberwhen checking element ordering - Added test case for multiple consecutive optional named tuple members
- Updated test snapshots to reflect the new test case and corrected babel test behavior
Reviewed changes
Copilot reviewed 1 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_parser/src/ts/types.rs | Extended tuple element validation to check TSNamedTupleMember.optional field alongside TSOptionalType when enforcing ordering constraints |
| tasks/coverage/misc/pass/ts-tuple-named-optional-member-twice.ts | New test case for two consecutive optional named tuple members |
| tasks/coverage/snapshots/parser_misc.snap | Updated to reflect new test case (62/62 tests) |
| tasks/coverage/snapshots/transformer_misc.snap | Updated to reflect new test case (62/62 tests) |
| tasks/coverage/snapshots/semantic_misc.snap | Updated to reflect new test case (62/62 tests) |
| tasks/coverage/snapshots/formatter_misc.snap | Updated to reflect new test case (62/62 tests) |
| tasks/coverage/snapshots/codegen_misc.snap | Updated to reflect new test case (62/62 tests) |
| tasks/coverage/snapshots/parser_babel.snap | Reflects that tuple-required-after-labeled-optional test now correctly produces TS(1257) error instead of parse error |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
2c76cdf to
37482eb
Compare

Introduced in #18146 and #18145