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

Fix implementation of JSX spread children #431

Merged
merged 1 commit into from
Mar 4, 2019

Conversation

alangpierce
Copy link
Owner

Fixes #420

This was actually already handled by the parser carried over from Babel, but
there was a bug in the tokenization, since Sucrase always skips the last token
so we can get the proper token type for the next one. After fixing that bug,
everything seems to work; no transformer changes are needed because argument
spread syntax is the same as JSX child spread syntax.

As mentioned in #420, Babel disallows this syntax with React and TypeScript
seems to give the wrong result, but this change like a good idea regardless
since it's just a bug fix.

Fixes #420

This was actually already handled by the parser carried over from Babel, but
there was a bug in the tokenization, since Sucrase always skips the last token
so we can get the proper token type for the next one. After fixing that bug,
everything seems to work; no transformer changes are needed because argument
spread syntax is the same as JSX child spread syntax.

As mentioned in #420, Babel disallows this syntax with React and TypeScript
seems to give the wrong result, but this change like a good idea regardless
since it's just a bug fix.
@alangpierce alangpierce merged commit 9eba7fb into master Mar 4, 2019
@alangpierce alangpierce deleted the fix-jsx-spread-children branch March 4, 2019 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spread children not supported
1 participant