Handles string literals in export clause

This commit is contained in:
Sid Shankar
2024-09-10 14:52:33 +00:00
parent 11658ad000
commit 385123cba1

View File

@@ -1203,11 +1203,13 @@ public class TypeScriptASTConverter {
Literal source = tryConvertChild(node, "moduleSpecifier", Literal.class);
Expression attributes = convertChild(node, "attributes");
if (hasChild(node, "exportClause")) {
JsonElement exportClauseNode = node.get("exportClause");
boolean hasTypeKeyword = node.get("isTypeOnly").getAsBoolean();
boolean isNamespaceExportNode = hasKind(exportClauseNode, "NamespaceExport");
List<ExportSpecifier> specifiers =
hasKind(node.get("exportClause"), "NamespaceExport")
? Collections.singletonList(convertChild(node, "exportClause"))
: convertChildren(node.get("exportClause").getAsJsonObject(), "elements");
isNamespaceExportNode
? Collections.singletonList(convertNodeAsIdentifier(exportClauseNode.getAsJsonObject()))
: convertChildren(exportClauseNode.getAsJsonObject(), "elements");
return new ExportNamedDeclaration(loc, null, specifiers, source, attributes, hasTypeKeyword);
} else {
return new ExportAllDeclaration(loc, source, attributes);