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

Issue:
Incorrect output for inline block statement containing an empty statement
**Describe the bug**

dprint-plugin-typescript version: 0.80.2

**Input Code**

An if statement with a block statement that only contains an empty statement, all in one line (see [Playground](https://dprint.dev/playground/#code/JYMwBAFALgTgrgUwJRgN4G4C+Q/language/typescript)):

```ts
if (true) {;}
```

**Expected Output**

dprint should remove the empty statement, but keep the block statement:

```ts
if (true) {}
```

**Actual Output**

dprint currently removes the block statement entirely:

```ts
if (true)
```

---

Note that dprint formats this code correctly when the block statement is not on a single line (see [Playground](https://dprint.dev/playground/#code/JYMwBAFALgTgrgUwJRgN4CgxbAbnQXyA/language/typescript)):

```ts
// Before
if (true) {
    ;
}

// After
if (true) {
}
```

Pull request description:
fix: braces in blocks with conditional braces should not be removed when containing a single empty statement
Closes #468

Patch:
diff --git a/src/generation/generate.rs b/src/generation/generate.rs
index 874cca2..26bcfaa 100644
--- a/src/generation/generate.rs
+++ b/src/generation/generate.rs
@@ -8336,7 +8336,7 @@ fn gen_conditional_brace_body<'a>(opts: GenConditionalBraceBodyOptions<'a>, cont
 
   fn get_force_braces(body_node: Node) -> bool {
     if let Node::BlockStmt(body_node) = body_node {
-      body_node.stmts.is_empty()
+      body_node.stmts.is_empty() || body_node.stmts.iter().all(|s| s.kind() == NodeKind::EmptyStmt)
     } else {
       false
     }


Test patch:
diff --git a/tests/specs/issues/issue0468.txt b/tests/specs/issues/issue0468.txt
new file mode 100644
index 0000000..bd9b67d
--- /dev/null
+++ b/tests/specs/issues/issue0468.txt
@@ -0,0 +1,19 @@
+== should not remove the braces in an if/while statement when the body contains empty statements ==
+if (true) {;}
+while (true) {;}
+
+// these going multi-line is ok... nobody should be writing this
+// and fixing it just adds more complexity
+if (true) {;;}
+while (true) {;;}
+
+[expect]
+if (true) {}
+while (true) {}
+
+// these going multi-line is ok... nobody should be writing this
+// and fixing it just adds more complexity
+if (true) {
+}
+while (true) {
+}