add support for namespaced JSX attributes

This commit is contained in:
erik-krogh
2023-06-01 21:52:14 +02:00
parent f4b68fb8c3
commit 97afa5733b
4 changed files with 131 additions and 1 deletions

View File

@@ -1552,8 +1552,13 @@ public class TypeScriptASTConverter {
}
private Node convertJsxAttribute(JsonObject node, SourceLocation loc) throws ParseError {
JsonObject nameNode = node.get("name").getAsJsonObject();
if (nameNode.get("name") != null) {
// it's a namespaced attribute
nameNode = nameNode.get("name").getAsJsonObject();
}
return new JSXAttribute(
loc, convertJSXName(convertChild(node, "name")), convertChild(node, "initializer"));
loc, convertJSXName(((Expression)convertNode(nameNode, null))), convertChild(node, "initializer")); // 2
}
private Node convertJsxClosingElement(JsonObject node, SourceLocation loc) throws ParseError {