Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 784f56f

Browse files
committedMay 29, 2017
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": [

‎tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js

Lines changed: 825 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module "foo" {
2+
export default class C {
3+
method(): C {};
4+
}
5+
export default function bar() {}
6+
}
7+

0 commit comments

Comments
 (0)