-
Notifications
You must be signed in to change notification settings - Fork 454
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 <rewinfrey@github.com>
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.