Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/showcase/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ShowcaseApp extends Widget {
if (event.key === 'q' || (event.ctrl && event.key === 'c')) return false;

// Tab switching: 1-5
const num = parseInt(event.key);
const num = parseInt(event.key, 10);
if (num >= 1 && num <= 5) {
this.switchTab(num - 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class DevTools {
renderTimeMs: timeMs,
widgetCount,
lastRenderAt: now,
fps: Math.round(fps * 10) / 10,
fps: Math.round(fps * 10 + Number.EPSILON) / 10,
memoryMB: Math.round((process.memoryUsage?.().heapUsed ?? 0) / 1024 / 1024 * 10) / 10,
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class DevServer {

this._killChild();

await exitedPromise.catch(() => {});
await exitedPromise.catch( => console.error());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
npx biome check packages/dev-server/src/server.ts

Repository: Karanjot786/TermUI

Length of output: 2385


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== Locate and inspect the reported line =="
wc -l packages/dev-server/src/server.ts
sed -n '360,395p' packages/dev-server/src/server.ts

echo "== Check whether the callback uses a valid parameter ==  "
python3 - <<'PY'
from pathlib import Path
import re
p = Path("packages/dev-server/src/server.ts")
text = p.read_text()
m = re.search(r"await\s+exitedPromise\.catch\s*\(\s*=>\s+console\.error\s*\(\)\s*\)\s*;", text)
print("arrow-catch-no-parameter-match=", bool(m))
if m:
    print(m.group(0))
PY

echo "== Type-check with the repo toolchain if available (read-only) =="
if command -v npx >/dev/null 2>&1; then
  npx tsc --noEmit --skipLibCheck packages/dev-server/src/server.ts || true
fi

Repository: Karanjot786/TermUI

Length of output: 2039


Fix the invalid catch callback syntax.

await exitedPromise.catch( => console.error()); is invalid TypeScript because the arrow callback has no parameters. This prevents the dev server from compiling. Pass the rejection value to console.error.

Proposed fix
-            await exitedPromise.catch( => console.error());
+            await exitedPromise.catch((error) => console.error(error));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await exitedPromise.catch( => console.error());
await exitedPromise.catch((error) => console.error(error));
🧰 Tools
🪛 Biome (2.5.6)

[error] 383-383: Expected a parenthesis '(' but instead found '=>'.

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dev-server/src/server.ts` at line 383, Fix the invalid rejection
callback in the exitedPromise handling by adding a parameter to the arrow
function passed to catch and forwarding that rejection value to console.error.
Preserve the existing await and error-handling flow.

Source: Linters/SAST tools


if (this._running && this._entryFile) {
this._spawnChild();
Expand Down
Loading