Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 784f56f

Browse files
committed
Breaking: Use ESTree export node types in modules (fixes# 263)
1 parent 3dcba7d commit 784f56f

File tree

4 files changed

+834
-10
lines changed

4 files changed

+834
-10
lines changed

lib/node-utils.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,7 @@ function fixExports(node, result, ast) {
486486
result.range[0] = varToken.getStart();
487487
result.loc = getLocFor(result.range[0], result.range[1], ast);
488488

489-
let declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
490-
491-
/**
492-
* Prefix exports from TypeScript namespaces with "TS" to distinguish
493-
* them from ES2015 exports
494-
*/
495-
if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) {
496-
declarationType = "TSNamespaceExportDeclaration";
497-
}
489+
const declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
498490

499491
const newResult = {
500492
type: declarationType,

tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = {
8686
},
8787
"body": [
8888
{
89-
"type": "TSNamespaceExportDeclaration",
89+
"type": "ExportNamedDeclaration",
9090
"declaration": {
9191
"type": "TSNamespaceFunctionDeclaration",
9292
"range": [

0 commit comments

Comments
 (0)