Skip to content

Commit 038a62c

Browse files
committed
fix: add type guard
1 parent 614c639 commit 038a62c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/language-js/comments/handle-comments.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ function handleCommentInEmptyParens({ comment, enclosingNode, text }) {
626626
((isRealFunctionLikeNode(enclosingNode) &&
627627
getFunctionParameters(enclosingNode).length === 0 &&
628628
// Make sure comment is before the function body (not in return value parentheses)
629-
(!enclosingNode.body ||
629+
(!("body" in enclosingNode) ||
630+
!enclosingNode.body ||
630631
locStart(comment) < locStart(enclosingNode.body))) ||
631632
(isCallLikeExpression(enclosingNode) &&
632633
getCallArguments(enclosingNode).length === 0))

0 commit comments

Comments
 (0)