Skip to content

fix(@angular/build): prevent syntax corruption for Crockford-style enum IIFE - #33791

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-oxc-crockford-enum-iife
Open

fix(@angular/build): prevent syntax corruption for Crockford-style enum IIFE#33791
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-oxc-crockford-enum-iife

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

When transforming Crockford-style TypeScript enum IIFEs (e.g. (function (E) { ... }(E || (E = {})));), ensure all leading and trailing parentheses of the expression statement are removed when moving the IIFE call expression to the var initializer so no dangling parentheses remain before subsequent statements.

Fixes #33785

…um IIFE

When transforming Crockford-style TypeScript enum IIFEs, ensure all leading and trailing parentheses of the expression statement are removed when moving the IIFE call expression to the var initializer.

Fixes angular#33785
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Aug 6, 2026
@alan-agius4
alan-agius4 requested a review from clydin August 6, 2026 07:52
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 6, 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 updates the OXC-based TypeScript enum transformation to correctly handle enums wrapped in parentheses, including Crockford-style IIFEs and nested parentheses, by removing leading/trailing characters and parentheses from the expression statement. It also adds comprehensive unit tests to verify these scenarios. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng build ts error unexpected const

2 participants