Skip to content

Conversation

overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Sep 21, 2025

Partial fix for #13851.

Raw transfer preserveParens option remove TSParenthesizedTypes from AST, same as #13855 removed ParenthesizedExpressions.

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 TSParenthesizedTypes in its AST.

Copy link
Member Author

overlookmotel commented Sep 21, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link

codspeed-hq bot commented Sep 21, 2025

CodSpeed Instrumentation Performance Report

Merging #13964 will not alter performance

Comparing 09-21-fix_napi_parser_raw_transfer_preserveparens_option_apply_to_tsparenthesizedtype_ (0185984) with main (830b733)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (0185984) during the generation of this report, so 830b733 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review September 21, 2025 10:11
@Copilot Copilot AI review requested due to automatic review settings September 21, 2025 10:11
Copy link
Contributor

@Copilot Copilot AI left a 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 on preserveParens 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.

@overlookmotel overlookmotel self-assigned this Sep 21, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Sep 21, 2025
Copy link
Member Author

overlookmotel commented Sep 21, 2025

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.
@graphite-app graphite-app bot force-pushed the 09-21-fix_napi_parser_raw_transfer_preserveparens_option_apply_to_tsparenthesizedtype_ branch from 5b2c840 to 0185984 Compare September 21, 2025 10:13
@graphite-app graphite-app bot merged commit 0185984 into main Sep 21, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 09-21-fix_napi_parser_raw_transfer_preserveparens_option_apply_to_tsparenthesizedtype_ branch September 21, 2025 10:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 21, 2025
This was referenced Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-parser Area - Parser C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant