-
-
Notifications
You must be signed in to change notification settings - Fork 667
fix(napi/parser): raw transfer preserveParens
option apply to TSParenthesizedType
#13964
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(napi/parser): raw transfer preserveParens
option apply to TSParenthesizedType
#13964
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 #13964 will not alter performanceComparing Summary
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 the raw transfer preserveParens
option to properly handle TSParenthesizedType
nodes in TypeScript AST parsing. When preserveParens
is false, TSParenthesizedType
nodes are removed from the AST to align with TS-ESLint behavior.
- Implements conditional serialization for
TSParenthesizedType
based onpreserveParens
option - Adds converter logic to handle raw deserialization with parentheses preservation control
- Updates tests to verify both preservation and removal of TypeScript parenthesized types
Reviewed Changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated no comments.
File | Description |
---|---|
crates/oxc_ast/src/serialize/ts.rs | Adds TSParenthesizedTypeConverter with conditional raw deserialization logic |
crates/oxc_ast/src/ast/ts.rs | Links TSParenthesizedType to use the new converter via estree attribute |
napi/parser/test/parse-raw.test.ts | Extends tests to verify TypeScript parenthesized type handling with both option values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
…renthesizedType` (#13964) Partial fix for #13851. Raw transfer `preserveParens` option remove `TSParenthesizedType`s from AST, same as #13855 removed `ParenthesizedExpression`s. This is not used in `oxc-parser`, but the raw transfer `preserveParens` option is required in `oxlint` JS plugins, to align with TS-ESLint, which has no `TSParenthesizedType`s in its AST.
5b2c840
to
0185984
Compare
Partial fix for #13851.
Raw transfer
preserveParens
option removeTSParenthesizedType
s from AST, same as #13855 removedParenthesizedExpression
s.This is not used in
oxc-parser
, but the raw transferpreserveParens
option is required inoxlint
JS plugins, to align with TS-ESLint, which has noTSParenthesizedType
s in its AST.