Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jsxPragmaFrag support to typescript transform #11950

Merged
merged 1 commit into from Oct 14, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Aug 11, 2020

Q                       A
Fixed Issues? Resolves #11935
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link babel/website#1945
Any Dependency Changes?
License MIT

This PR adds support for jsxPragmaFrag so that preset-typescript does not elide Fragment imports like import { Fragment } from "preact".

Prior work: #9317, unfortunately that PR was abandoned due to lack of upstream support at that time. /cc @Tarnadas, the author of #9317.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 11, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2ec058d:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Aug 11, 2020

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

@@ -47,15 +47,16 @@ export default declare(
(
api,
{
jsxPragma = "React",
jsxPragma = "React.createElement",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is invisible to users since (jsxPragmaFrag).split(".")[0] still returns React. It is meant to align with

const DEFAULT = {
pragma: "React.createElement",
pragmaFrag: "React.Fragment",
};

@calebeby
Copy link
Contributor

Hi! Is there a blocker for merge or is this ready to go?

@JLHwung JLHwung added this to the v7.12.0 milestone Sep 17, 2020
@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Sep 28, 2020
@nicolo-ribaudo nicolo-ribaudo changed the title feat: add jsxPragmaFrag support to typescript transform Add jsxPragmaFrag support to typescript transform Oct 14, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit d0d1fdb into babel:main Oct 14, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the add-jsxPragmaFrag branch October 14, 2020 18:12
@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 Jan 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: jsx area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support jsxFragmentPragma TypeScript 4 option in transform-typescript plugin
6 participants