Skip to content

Ensure whitespace jsx elements are not counted when determining if a jsx child is the only child #40839

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

Merged
merged 4 commits into from
Oct 1, 2020

Conversation

weswigham
Copy link
Member

Fixes #40774

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 29, 2020
Comment on lines 28 to 31
console.log(jsx_runtime_1.jsxs("div", { children: jsx_runtime_1.jsx("div", {}, void 0) }, void 0));
console.log(jsx_runtime_1.jsxs("div", { children: [jsx_runtime_1.jsx("div", {}, void 0),
jsx_runtime_1.jsx("div", {}, void 0)] }, void 0));
console.log(jsx_runtime_1.jsxs("div", { children: [1, 2].map(function (i) { return jsx_runtime_1.jsx("div", { children: i }, i); }) }, void 0));

Choose a reason for hiding this comment

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

Should the first and third examples use jsx instead of jsxs? Babel does it, so I'm curious.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated it to do so - we can always change back if that's not desirable for some reason.

@weswigham weswigham merged commit 3ea81e6 into microsoft:master Oct 1, 2020
@weswigham weswigham deleted the jsx-singleton-transform branch October 1, 2020 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected JSX output for children with jsx: react-jsx
5 participants