Repository: babel/babel (TypeScript)

Issue:
[Bug]: export import does not export in Babel (works in TypeScript)
### 💻

- [ ] Would you like to work on a fix?

### How are you using Babel?

babel-loader (webpack)

### Input code

TypeScript code
```js
import * as joint from '@joint/core';

export import JGraph = joint.dia.Graph;
```


### Configuration file name

_No response_

### Configuration

_No response_

### Current and expected behavior

Is transpiled in TypeScript correctly to 

```js
import * as joint from '@joint/core';
export var JGraph = joint.dia.Graph;
```

But Babel transpiles it to 
```js
import * as joint from "@joint/core";
var JGraph = joint.dia.Graph;
```
There is no `export`.

### Environment

https://babeljs.io/repl

https://www.typescriptlang.org/play/

### Possible solution

_No response_

### Additional context

_No response_


Hints:
Hey @tomasbruckner! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant [Slack community](https://babeljs.slack.com) that typically always has someone willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite.

Patch:
diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts
--- a/packages/babel-plugin-transform-typescript/src/index.ts
+++ b/packages/babel-plugin-transform-typescript/src/index.ts
@@ -604,7 +604,7 @@ export default declare((api, opts: Options) => {
         path: NodePath<t.TSImportEqualsDeclaration>,
         pass,
       ) {
-        const { id, moduleReference } = path.node;
+        const { id, moduleReference, isExport } = path.node;
 
         let init: t.Expression;
         let varKind: "var" | "const";
@@ -626,9 +626,12 @@ export default declare((api, opts: Options) => {
           init = entityNameToExpr(moduleReference);
           varKind = "var";
         }
+        const newNode = t.variableDeclaration(varKind, [
+          t.variableDeclarator(id, init),
+        ]);
 
         path.replaceWith(
-          t.variableDeclaration(varKind, [t.variableDeclarator(id, init)]),
+          isExport ? t.exportNamedDeclaration(newNode) : newNode,
         );
         path.scope.registerDeclaration(path);
       },


Test patch:
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/input.ts
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/input.ts
@@ -0,0 +1,3 @@
+import * as joint from '@joint/core';
+
+export import JGraph = joint.dia.Graph;
diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/output.mjs
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-transform-typescript/test/fixtures/exports/export-import=/output.mjs
@@ -0,0 +1,2 @@
+import * as joint from '@joint/core';
+export var JGraph = joint.dia.Graph;