Hack to get export default work (#1866)

Fixes #1854
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-02 08:12:03 -07:00
1 parent 38eec13a03
commit faf2ac5f9e
2 files changed
+10 -2

No files matched your search

+9 -1
View File
@@ -2414,7 +2414,15 @@ function genericPrintNoParens(path, options, print, args) {
return concat(parts);
case "TSNamespaceExportDeclaration":
if (n.declaration) {
parts.push("export ", path.call(print, "declaration"));
// Temporary fix until https://github.com/eslint/typescript-eslint-parser/issues/263
const isDefault = options.originalText
.slice(util.locStart(n), util.locStart(n.declaration))
.match(/\bdefault\b/);
parts.push(
"export ",
isDefault ? "default " : "",
path.call(print, "declaration")
);
} else {
parts.push("export as namespace ", path.call(print, "name"));
@@ -381,7 +381,7 @@ declare module "foo" {
declare module "foo" {
export var before: C;
export class C {
export default class C {
method(): C;
}