Repository: dprint/dprint-plugin-typescript (rust)

Issue:
Arrow function parameters containing comment has parens removed incorrectly
**Describe the bug**

dprint-plugin-typescript version: 0.85.0

**Input Code**

```ts
client
    .send(lookup)
    .then((
        resp, // $ExpectType Batch<Lookup>
    ) => console.log(resp))
    .catch((
        err, // $ExpectType any
    ) => console.error(err));
```

Config:

```json
{
  "arrowFunction.useParentheses": "preferNone"
}
```

**Expected Output**

```ts
client
    .send(lookup)
    .then((
        resp, // $ExpectType Batch<Lookup>
    ) => console.log(resp))
    .catch((
        err, // $ExpectType any
    ) => console.error(err));
```

(or something)

**Actual Output**

```ts
client
    .send(lookup)
    .then(resp // $ExpectType Batch<Lookup>
     => console.log(resp))
    .catch(err // $ExpectType any
     => console.error(err));
```

Hit roughly 4 times in testing DT with dprint.

Pull request description:
fix: arrow func single param paren should not be removed when has trailing comma with trailing comments
Closes #533

Patch:
diff --git a/src/generation/generate.rs b/src/generation/generate.rs
index fa9e74b..e2a37d2 100644
--- a/src/generation/generate.rs
+++ b/src/generation/generate.rs
@@ -1762,11 +1762,21 @@ fn gen_arrow_func_expr<'a>(node: &'a ArrowExpr<'a>, context: &mut Context<'a>) -
     fn is_first_param_not_identifier_or_has_type_annotation<'a>(params: &[Pat<'a>], arrow: &ArrowSignature<'a>, program: Program<'a>) -> bool {
       match params.get(0) {
         Some(Pat::Ident(node)) => {
-          node.type_ann.is_some() || node.id.optional() || node_helpers::has_surrounding_comments((*node).into(), program) && has_parens(arrow, program)
+          node.type_ann.is_some() || node.id.optional() || param_has_surrounding_comments((*node).into(), program) && has_parens(arrow, program)
         }
         _ => true,
       }
     }
+
+    fn param_has_surrounding_comments<'a>(param: Node<'a>, program: Program<'a>) -> bool {
+      if node_helpers::has_surrounding_comments(param, program) {
+        true
+      } else if let Some(comma_token) = param.next_token_fast(program).filter(|t| t.token == Token::Comma) {
+        !comma_token.trailing_comments_fast(program).is_empty()
+      } else {
+        false
+      }
+    }
   }
 
   fn has_parens<'a>(node: &ArrowSignature<'a>, program: Program<'a>) -> bool {


Test patch:
diff --git a/tests/specs/issues/issue0533.txt b/tests/specs/issues/issue0533.txt
new file mode 100644
index 0000000..aeb1e7a
--- /dev/null
+++ b/tests/specs/issues/issue0533.txt
@@ -0,0 +1,20 @@
+~~ arrowFunction.useParentheses: preferNone ~~
+== should maintain parens around params in arrow function with single param and trailing comment ==
+client
+    .send(lookup)
+    .then((
+        resp, // $ExpectType Batch<Lookup>
+    ) => console.log(resp))
+    .catch((
+        err, // $ExpectType any
+    ) => console.error(err));
+
+[expect]
+client
+    .send(lookup)
+    .then((
+        resp, // $ExpectType Batch<Lookup>
+    ) => console.log(resp))
+    .catch((
+        err, // $ExpectType any
+    ) => console.error(err));