-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1397 from PartMan7/support-typedef-tsx
printer: Support type parameters on JSX components in TSX
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
|
||
const nodeMajorVersion = parseInt(process.versions.node, 10); | ||
import * as parser from "../parsers/babel-ts"; | ||
import { EOL as eol } from "os"; | ||
import * as recast from "../main"; | ||
import assert from "assert"; | ||
|
||
(nodeMajorVersion >= 6 ? describe : xdescribe)( | ||
"Babel TSX Compatibility", | ||
function () { | ||
function check(lines: string[]) { | ||
const code = lines.join(eol); | ||
const ast = recast.parse(code, { parser }); | ||
const output = recast.prettyPrint(ast, { tabWidth: 2 }).code; | ||
assert.strictEqual(code, output); | ||
} | ||
|
||
it("should parse and print typed JSX elements", function () { | ||
check(["<Foo<Bar> />;"]); | ||
}); | ||
}, | ||
); |