Skip to content

fix(generator): keep parens for ?. chain in tag - #18202

Merged
JLHwung merged 1 commit into
babel:mainfrom
JLHwung:fix-18199
Aug 25, 2026
Merged

JLHwung merged 1 commit into
babel:mainfrom
JLHwung:fix-18199

Conversation

@JLHwung

@JLHwung JLHwung commented Aug 24, 2026

Copy link
Copy Markdown
Contributor
Q 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 A
Fixed Issues? Fixes #18199, closes #18201
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we improve the parentheses rules for a template tag. Similar to how we handle the new callee, we have to unwrap the TS non-null expression before we check if we have met an optional chain.

This PR also improves the new callee parentheses rules, previously the TSInstantiationExpression is missed.

@JLHwung
JLHwung requested a review from liuxingbaoyu August 24, 2026 14:11
@JLHwung JLHwung added PR: Bug Fix 馃悰 A type of pull request used for our changelog categories pkg: generator labels Aug 24, 2026
@babel-bot

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/62033

@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

commit: cda54a0

@JLHwung
JLHwung merged commit b536617 into babel:main Aug 25, 2026
58 checks passed
@JLHwung
JLHwung deleted the fix-18199 branch August 25, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: generator PR: Bug Fix 馃悰 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@babel/generator produce syntactically incorrect code on tags + opt chains in parens

3 participants