-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Added support for attributes returning JSX
- Loading branch information
Showing
5 changed files
with
14 additions
and
16 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import * as ts from "typescript"; | ||
|
||
export default function getValue(node) { | ||
export default function getValue(node, visitor) { | ||
if (node.kind === ts.SyntaxKind.StringLiteral) { | ||
return ts.createLiteral(node.text); | ||
} | ||
if (node.kind === ts.SyntaxKind.JsxExpression) { | ||
return node.expression; | ||
return visitor(node.expression); | ||
} | ||
} |
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 @@ | ||
<div foo={() => (<div bar />)} /> |
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,3 @@ | ||
var Inferno = require("inferno"); | ||
var createVNode = Inferno.createVNode; | ||
createVNode(2, "div", null, null, { "foo": function () { return (createVNode(2, "div", null, null, { "bar": true })); } }); |