Closed PartMan7 closed 2 months ago
I'd add a test to test/jsx.ts
.
test/jsx.ts
is currently only running with babel and esprima, which (please correct me if I'm wrong) don't support TypeScript syntax (eg: tests crash even with <b>{'a' as string}</b>
, which is valid and supported TSX). From what I could tell, the TSX tests run for recast are limited to those directly taken from babel-parser's fixtures - could you please point me in the right direction?
I guess I'd probably create a test/tsx.ts
file that parses with the typescript
option and put the tests in there.
Hope this works!
Thanks! Published in v0.23.7.
Supports actually parsing cases like
<Foo<Bar> />
instead of crashing.Was unsure how to test this, since the existing code inherits from babel-parser's fixtures, and that doesn't currently have any tests of the sort (though it is a supported format).
Please let me know if there's any changes / modifications needed to the PR!
Demonstration on Babel REPL