Skip to content

fix(parser): improve super type argument parsing#17720

Merged
nicolo-ribaudo merged 1 commit intobabel:mainfrom
JLHwung:fix-17719
Jan 27, 2026
Merged

fix(parser): improve super type argument parsing#17720
nicolo-ribaudo merged 1 commit intobabel:mainfrom
JLHwung:fix-17719

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 22, 2026

Q                       A
Fixed Issues? Fixes #17719
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 explode TSInstantiateExpression into superClass and superTypeArgument when it is seen in the heritage clause. The comments are preserved because the TSInstantiateExpression node is essentially removed from the AST.

It is impossible to tell whether we should exit early when we see { after type arguments: It can indicate either the start of class body, or the start of a new block statement. Therefore we have to manipulate the AST instead.

@JLHwung JLHwung added pkg: parser PR: Bug Fix (next major) 🐛 A type of pull request used for our changelog categories for next major release 7.x: needs backport labels Jan 22, 2026
@babel-bot
Copy link
Collaborator

babel-bot commented Jan 22, 2026

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 22, 2026

Open in StackBlitz

commit: ee22146

@nicolo-ribaudo nicolo-ribaudo merged commit 829ae05 into babel:main Jan 27, 2026
54 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the fix-17719 branch January 27, 2026 16:20
@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories PR: Bug Fix (next major) 🐛 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect superTypeArguments parsing

3 participants