Skip to content

Rename typeParameters to typeArguments for call expression alike#17020

Merged
JLHwung merged 5 commits intobabel:mainfrom
JLHwung:call-expression-type-arguments
Dec 16, 2024
Merged

Rename typeParameters to typeArguments for call expression alike#17020
JLHwung merged 5 commits intobabel:mainfrom
JLHwung:call-expression-type-arguments

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Dec 12, 2024

Q                       A
Fixed Issues? #16679
Patch: Bug Fix?
Major: Breaking Change? Yes
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#3032
Any Dependency Changes?
License MIT

In this PR we rename for typeParameters to typeArguments for the following call expression alike expressions: CallExpression, JSXOpeningElement, NewExpression, OptionalCallExpression and TSInstantiationExpression.

@JLHwung JLHwung added the PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release label Dec 12, 2024
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Dec 12, 2024

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

validate: assertNodeType("TemplateLiteral"),
},
typeParameters: {
[process.env.BABEL_8_BREAKING ? "typeArguments" : "typeParameters"]: {
Copy link
Copy Markdown
Contributor Author

@JLHwung JLHwung Dec 12, 2024

Choose a reason for hiding this comment

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

Although this change also affect the flow AST, it does not have practical impact for flow codemod, because Flow does not support type arguments in TaggedTemplateExpression yet, e.g. foo<bar>`q`.

},
attributes: validateArrayOfType("JSXAttribute", "JSXSpreadAttribute"),
typeParameters: {
[process.env.BABEL_8_BREAKING ? "typeArguments" : "typeParameters"]: {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change also aligns to the Flow AST (playground link).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here we changed the JSX Flow AST but none of Flow tests are broken. I suspect we don't have test coverage here or we actually do not support transform-flow with syntax-jsx. I will investigate this issue later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume that nobody noticed because the JSX transform is going to drop the types anyway when converting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, so the flow AST change here actually breaks nobody because Babel parser does not support <Foo<T>></Foo> yet when both Flow and JSX plugins are enabled: (REPL), this is a bug and I'd better fix it in another PR.

@JLHwung
Copy link
Copy Markdown
Contributor Author

JLHwung commented Dec 13, 2024

The test262 failure is very confusing. From the REPL build of this PR, the transpiled output of https://github.com/tc39/test262/blob/main/test/language/expressions/assignment/S11.13.1_A7_T4.js is not changed when compared with the main branch.

I suspect it is an old V8 optimizer bug and I will rebase the working branch just to trigger the full test262 tests again.

@JLHwung JLHwung force-pushed the call-expression-type-arguments branch from d08a88b to c2731bb Compare December 13, 2024 16:18
@nicolo-ribaudo
Copy link
Copy Markdown
Member

It seems like re-running worker

JLHwung and others added 5 commits December 13, 2024 13:58
@JLHwung JLHwung force-pushed the call-expression-type-arguments branch from ec291e8 to 9c0c0b1 Compare December 13, 2024 18:58
@JLHwung
Copy link
Copy Markdown
Contributor Author

JLHwung commented Dec 16, 2024

Added the docs for this change, please also take a look. If the docs looks good, this PR can be merged.

@JLHwung JLHwung merged commit 3d36199 into babel:main Dec 16, 2024
@JLHwung JLHwung deleted the call-expression-type-arguments branch December 16, 2024 20:09
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 18, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Breaking Change 💥 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.

4 participants