esrap 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handlers.js +26 -0
package/package.json
CHANGED
package/src/handlers.js
CHANGED
|
@@ -605,6 +605,16 @@ function handle_type_annotation(node, state) {
|
|
|
605
605
|
handle_type_annotation(node.indexType, state);
|
|
606
606
|
state.commands.push(']');
|
|
607
607
|
break;
|
|
608
|
+
case 'TSImportType':
|
|
609
|
+
state.commands.push('import(');
|
|
610
|
+
handle(node.argument, state);
|
|
611
|
+
state.commands.push(')');
|
|
612
|
+
|
|
613
|
+
if (node.qualifier) {
|
|
614
|
+
state.commands.push('.');
|
|
615
|
+
handle(node.qualifier, state);
|
|
616
|
+
}
|
|
617
|
+
break;
|
|
608
618
|
default:
|
|
609
619
|
throw new Error(`Not implemented type annotation ${node.type}`);
|
|
610
620
|
}
|
|
@@ -1506,6 +1516,22 @@ const handlers = {
|
|
|
1506
1516
|
state.commands.push(dedent, newline, '}', newline);
|
|
1507
1517
|
},
|
|
1508
1518
|
|
|
1519
|
+
TSModuleBlock(node, state) {
|
|
1520
|
+
state.commands.push(' {', indent, newline);
|
|
1521
|
+
sequence(node.body, state, false, handle);
|
|
1522
|
+
state.commands.push(dedent, newline, '}');
|
|
1523
|
+
},
|
|
1524
|
+
|
|
1525
|
+
TSModuleDeclaration(node, state) {
|
|
1526
|
+
if (node.declare) state.commands.push('declare ');
|
|
1527
|
+
else state.commands.push('namespace ');
|
|
1528
|
+
|
|
1529
|
+
handle(node.id, state);
|
|
1530
|
+
|
|
1531
|
+
if (!node.body) return;
|
|
1532
|
+
handle(node.body, state);
|
|
1533
|
+
},
|
|
1534
|
+
|
|
1509
1535
|
TSNonNullExpression(node, state) {
|
|
1510
1536
|
handle(node.expression, state);
|
|
1511
1537
|
state.commands.push('!');
|