Skip to content

Commit

Permalink
feature: @putout/printer: TSTypeAliasDeclaration: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Oct 24, 2023
1 parent f900463 commit 689ec53
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/tokenize/typescript/type/ts-type-alias-declaration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';

const {isLast, isNext} = require('../../is');
const {
isLast,
isNext,
isNextParent,
} = require('../../is');

const {markAfter} = require('../../mark');
const {maybeDeclare} = require('../../maybe/maybe-declare');
const isNextType = (a) => a.getNextSibling().isTSTypeAliasDeclaration();
Expand Down Expand Up @@ -30,10 +35,13 @@ module.exports.TSTypeAliasDeclaration = {
if (last)
return false;

if (!isNext(path) && !isNextParent(path))
return false;

return !isNextType(path);
},
after(path, {maybe}) {
maybe.print.newline(isNext(path) || isNext(path.parentPath));
after(path, {print}) {
print.newline();
markAfter(path);
},
};

0 comments on commit 689ec53

Please sign in to comment.