Skip to content

Commit

Permalink
Never print a semicolon after export default interface Foo {} (#4128)
Browse files Browse the repository at this point in the history
* Never print a semicolon after `export default interface Foo {}`

* Add test
  • Loading branch information
j-f1 committed Apr 11, 2018
1 parent 7819a8f commit 63a2ded
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -3628,6 +3628,7 @@ function printExportDeclaration(path, options, print) {
(decl.declaration.type !== "ClassDeclaration" &&
decl.declaration.type !== "FunctionDeclaration" &&
decl.declaration.type !== "TSAbstractClassDeclaration" &&
decl.declaration.type !== "TSInterfaceDeclaration" &&
decl.declaration.type !== "DeclareClass" &&
decl.declaration.type !== "DeclareFunction")
) {
Expand Down
11 changes: 11 additions & 0 deletions tests/typescript_export/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ a;
`;

exports[`default.js 1`] = `
export default interface Foo {
readonly bar?: string;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export default interface Foo {
readonly bar?: string;
}
`;

exports[`export.ts 1`] = `
declare module "hello" {
export default Hello;
Expand Down
3 changes: 3 additions & 0 deletions tests/typescript_export/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default interface Foo {
readonly bar?: string;
}

0 comments on commit 63a2ded

Please sign in to comment.