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 f497498
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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
@@ -1,4 +1,4 @@
; // Otherwise-empty file
export declare namespace P {
export namespace C {}
export namespace C { }
}
@@ -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 f497498

Please sign in to comment.