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

Commit 0205523

Browse files
committed
Breaking: Use ESTree export node types in modules (fixes# 263)
1 parent f836bb9 commit 0205523

File tree

4 files changed

+834
-10
lines changed

4 files changed

+834
-10
lines changed

lib/node-utils.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,7 @@ function fixExports(node, result, ast) {
462462
result.range[0] = varToken.getStart();
463463
result.loc = getLocFor(result.range[0], result.range[1], ast);
464464

465-
let declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
466-
467-
/**
468-
* Prefix exports from TypeScript namespaces with "TS" to distinguish
469-
* them from ES2015 exports
470-
*/
471-
if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) {
472-
declarationType = "TSNamespaceExportDeclaration";
473-
}
465+
const declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration";
474466

475467
const newResult = {
476468
type: declarationType,

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

+1-1
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)