Repository: sandersn/downlevel-dts (js)

Issue:
Downlevel 'import type' and 'export type'
```diff
- import type {Something} from 'somewhere';
# import {Something} from 'somewhere';
```

Pull request description:
Downlevel import type and export type
Fixes #6

Patch:
diff --git a/index.js b/index.js
index c57b69c..a357383 100644
--- a/index.js
+++ b/index.js
@@ -75,6 +75,15 @@ function doTransform(k) {
           n.moduleSpecifier
         )
       ];
+    } else if (ts.isExportDeclaration(n) && n.isTypeOnly) {
+      return ts.createExportDeclaration(
+        n.decorators,
+        n.modifiers,
+        n.exportClause,
+        n.moduleSpecifier
+      );
+    } else if (ts.isImportClause(n) && n.isTypeOnly) {
+      return ts.createImportClause(n.name, n.namedBindings);
     }
     return ts.visitEachChild(n, transform, k);
   };


Test patch:
diff --git a/baselines/ts3.4/src/test.d.ts b/baselines/ts3.4/src/test.d.ts
index a800eaa..4da9559 100644
--- a/baselines/ts3.4/src/test.d.ts
+++ b/baselines/ts3.4/src/test.d.ts
@@ -10,3 +10,4 @@ export namespace N {
         r: boolean;
     }
 }
+export { C as DetectiveComics };
diff --git a/baselines/ts3.4/test.d.ts b/baselines/ts3.4/test.d.ts
index 8a805f7..c06de10 100644
--- a/baselines/ts3.4/test.d.ts
+++ b/baselines/ts3.4/test.d.ts
@@ -10,5 +10,6 @@ export namespace N {
         abstract r: boolean;
     }
 }
-import * as rex_1 from "src/test";
-export { rex_1 as rex } from "src/test";
+import { C as CD } from "./src/test";
+import * as rex_1 from "./src/test";
+export { rex_1 as rex } from "./src/test";
diff --git a/test/src/test.d.ts b/test/src/test.d.ts
index 3cf35d5..93c1def 100644
--- a/test/src/test.d.ts
+++ b/test/src/test.d.ts
@@ -12,3 +12,5 @@ export namespace N {
         set r(value: boolean)
     }
 }
+
+export type { C as DetectiveComics };
diff --git a/test/test.d.ts b/test/test.d.ts
index 271ea8c..c16db72 100644
--- a/test/test.d.ts
+++ b/test/test.d.ts
@@ -12,5 +12,6 @@ export namespace N {
     abstract set r(value: boolean);
   }
 }
+import type { C as CD } from "./src/test";
 
-export * as rex from "src/test";
+export * as rex from "./src/test";