Skip to content

fix(@angular/build): support parenthesized expressions in oxc linker - #34136

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix-oxc-linker-parenthesized-expressions
Sep 21, 2026
Merged

clydin merged 1 commit into
angular:mainfrom
clydin:fix-oxc-linker-parenthesized-expressions

Conversation

@clydin

@clydin clydin commented Sep 21, 2026

Copy link
Copy Markdown
Member

Unwrap parenthesized expressions in OxcAstHost to ensure parity with Babel and prevent fatal linker errors when parsing functions returning parenthesized expressions (such as resolveMetadata: () => ({ ... }) in deferred component metadata) and other parenthesized declaration properties.

Fixes #34129

@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Sep 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for parenthesized expressions in the OXC AST host by implementing an unwrapParentheses helper function and applying it across various AST querying and parsing methods. This ensures that parenthesized nodes, such as parenthesized literals, objects, or functions, are correctly unwrapped and processed by the linker. Corresponding unit and integration tests have been added to verify this behavior. Feedback is provided regarding the isMinifiedBooleanLiteral helper function, where the type guard signature is no longer strictly accurate at runtime due to the potential presence of a ParenthesizedExpression wrapping the argument; simplifying this signature to node is UnaryExpression is recommended to maintain type safety.

Comment thread packages/angular/build/src/tools/angular/linker/oxc-ast-host.ts Outdated
@clydin
clydin force-pushed the fix-oxc-linker-parenthesized-expressions branch from 820602f to 29bcef1 Compare September 21, 2026 17:36
Unwrap parenthesized expressions in `OxcAstHost` to ensure parity with Babel
and prevent fatal linker errors when parsing functions returning parenthesized
expressions (such as `resolveMetadata: () => ({ ... })` in deferred component
metadata) and other parenthesized declaration properties.

Fixes angular#34129
@clydin
clydin force-pushed the fix-oxc-linker-parenthesized-expressions branch from 29bcef1 to 4f44e9a Compare September 21, 2026 17:38
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 21, 2026
@clydin
clydin requested a review from alan-agius4 September 21, 2026 17:41
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 21, 2026
@clydin
clydin merged commit 43aab6a into angular:main Sep 21, 2026
41 checks passed
@clydin

clydin commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the fix-oxc-linker-parenthesized-expressions branch September 21, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Oxc linker rejects parenthesized resolveMetadata return in deferred class metadata

2 participants