@eliasku/ts-transformers 0.0.5 → 0.0.6
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/index.ts +15 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -58,6 +58,13 @@ function createTransformerFactory(
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
if (ts.isExportSpecifier(node)) {
|
|
62
|
+
const removed = tryRemoveConstEnumExport(node);
|
|
63
|
+
if (removed === undefined || node.isTypeOnly) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
if (ts.isImportClause(node)) {
|
|
62
69
|
const removed = tryRemoveConstEnumImportClause(node);
|
|
63
70
|
if (removed === undefined) {
|
|
@@ -672,6 +679,14 @@ function createTransformerFactory(
|
|
|
672
679
|
return node;
|
|
673
680
|
}
|
|
674
681
|
|
|
682
|
+
function tryRemoveConstEnumExport(node: ts.ExportSpecifier): ts.ExportSpecifier | undefined {
|
|
683
|
+
const importedType = typeChecker.getTypeAtLocation(node);
|
|
684
|
+
if (isConstEnumType(importedType)) {
|
|
685
|
+
return undefined;
|
|
686
|
+
}
|
|
687
|
+
return node;
|
|
688
|
+
}
|
|
689
|
+
|
|
675
690
|
function tryRemoveConstEnumImportClause(node: ts.ImportClause): ts.ImportClause | undefined {
|
|
676
691
|
if (!node.name) return node;
|
|
677
692
|
const type = typeChecker.getTypeAtLocation(node.name);
|