Skip to content

Commit d9eadc7

Browse files
authored
fix: keep paren around expr for @satisfies jsdoc (#735)
1 parent 53a450c commit d9eadc7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/generation/generate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,9 +2885,9 @@ fn should_skip_paren_expr<'a>(node: &'a ParenExpr<'a>, context: &Context<'a>) ->
28852885
return false;
28862886
}
28872887

2888-
// keep when there is a JSDoc type assertion
2888+
// keep when there is a JSDoc because it could be a type assertion or satisfies
28892889
for c in node.leading_comments_fast(context.program) {
2890-
if c.kind == CommentKind::Block && c.text.starts_with('*') && c.text.contains("@type") {
2890+
if c.kind == CommentKind::Block && c.text.starts_with('*') {
28912891
return false;
28922892
}
28932893
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
~~ deno: true ~~
2+
== should not remove parens ==
3+
foo(/** @satisfies {Bar} */ ({ a: true }));
4+
5+
[expect]
6+
foo(/** @satisfies {Bar} */ ({ a: true }));

0 commit comments

Comments
 (0)