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

liuxingbaoyu
liuxingbaoyu approved these changes