Skip to content

Commit

Permalink
Declare class in namespace should be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yimingjfe committed Jul 20, 2022
1 parent b807206 commit afc6949
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/babel-plugin-transform-typescript/src/namespace.ts
Expand Up @@ -185,6 +185,13 @@ function handleNested(
case "TSEnumDeclaration":
case "FunctionDeclaration":
case "ClassDeclaration": {
if (
subNode.declaration.type === "ClassDeclaration" &&
subNode.declaration.declare
) {
continue;
}

const itemName = subNode.declaration.id.name;
names.add(itemName);
namespaceTopLevel.splice(
Expand Down
@@ -0,0 +1,4 @@
export namespace A {
export declare class B {
}
}
@@ -0,0 +1,3 @@
export let A;

(function (_A) {})(A || (A = {}));

0 comments on commit afc6949

Please sign in to comment.