Skip to content

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Dec 16, 2024

Q                       A
Fixed Issues? Babel does not support Flow type arguments in JSXOpeningElement
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR introduces support for the Flow type arguments in JSXOpeningElement, e.g. <Component<string>></Component>. The implementation is mostly borrowed directly from the previous TypeScript implementation (#11912 and #14145).

@babel-bot
Copy link
Collaborator

babel-bot commented Dec 16, 2024

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


# Re-enable this test once prettier updated the snapshot
# https://github.com/babel/babel/pull/17028
rm -r tests/format/flow/jsx/format.test.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

/cc @fisker


JSX/invalid_unpaired_gt.js
JSX/invalid_unpaired_rcurly.js
JSX/jsx_type_args_types_disabled.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this test, <Component<T> /> is parsed with the flow parser option { types: false }, but we don't have a mirroring parser option.

@JLHwung JLHwung marked this pull request as ready for review December 16, 2024 23:11
@JLHwung JLHwung force-pushed the support-flow-jsx-opening-element-type-arguments branch from a7826f3 to cbeba81 Compare January 6, 2025 15:59
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I would consider this to be a bugfix

@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jan 8, 2025
@JLHwung JLHwung merged commit 5fc3f75 into babel:main Jan 8, 2025
55 checks passed
@JLHwung JLHwung deleted the support-flow-jsx-opening-element-type-arguments branch January 8, 2025 16:28
laine-hallot pushed a commit to laine-hallot/uwu-parser that referenced this pull request Mar 31, 2025
* refactor: rename tsInNoContext to tsInTopLevelContext

* fix: support type arguments in JSXOpeningElement

* add test cases

* update per Babel 8 AST

* define typeArguments and remove it in flow transform

* update generated AST types

* fix typing errors

* e2e: ignore the broken prettier test

The test is broken because we now support typeArguments in JSXOpeningElement

* update test allowlist
@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 Apr 10, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

4 participants