-
Notifications
You must be signed in to change notification settings - Fork 451
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
Use TSX parser instead of Typescript parser for JavaScript and JSX #229
Conversation
Is there any testing that should be added for this? Previously, we would have gotten parse errors on any |
Let's do something like this, but with a |
Also, add a unit test for JSX in JavaScript. Co-Authored-By: Rick Winfrey <[email protected]>
While we were here, @rewinfrey and I also added some limited support for Type arguments in TSX (microsoft/TypeScript#22415). |
@@ -6,6 +6,7 @@ | |||
(JsxElement | |||
(JsxOpeningElement | |||
(Identifier) | |||
(Empty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsxOpeningElement
terms now have an optional TypeArguments
child. We based this off the way that type arguments are handled in the New
node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can we do a manually run of the parse-examples
target (we use to do this in CI, but travis can't quiet keep up with the workload)?
JavaScript (and
.jsx
) files can contain JSX (and cannot use TypeScript's type assertion syntax), so we need to use the TSX dialect of TypeScript when parsing and analyzing them.