Skip to content

Commit

Permalink
Implement TypeScript namespace support
Browse files Browse the repository at this point in the history
This also fixes enum not adding the respective declaration to the scope
during the typescript visitation.
  • Loading branch information
Wolvereness committed May 28, 2019
1 parent a596da2 commit 6be5773
Show file tree
Hide file tree
Showing 36 changed files with 920 additions and 310 deletions.
4 changes: 3 additions & 1 deletion packages/babel-plugin-transform-typescript/src/enum.js
Expand Up @@ -24,7 +24,9 @@ export default function transpileEnum(path, t) {
path.remove();
} else {
const isGlobal = t.isProgram(path.parent); // && !path.parent.body.some(t.isModuleDeclaration);
path.replaceWith(makeVar(node.id, t, isGlobal ? "var" : "let"));
path.scope.registerDeclaration(
path.replaceWith(makeVar(node.id, t, isGlobal ? "var" : "let"))[0],
);
}
break;
}
Expand Down

0 comments on commit 6be5773

Please sign in to comment.