diff --git a/src/printer.js b/src/printer.js index 7c7a70eb8..b526894d8 100644 --- a/src/printer.js +++ b/src/printer.js @@ -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")); diff --git a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap index c7de3c9c7..51d9ab59b 100644 --- a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap @@ -381,7 +381,7 @@ declare module "foo" { declare module "foo" { export var before: C; - export class C { + export default class C { method(): C; }