From 4b2f6be01e2cbe8dcc6a66d9ed2fdd66f4f0fd48 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Fri, 7 Aug 2026 13:36:35 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/calculator/src/index.tsx | 2 +- examples/widget-gallery/src/index.ts | 2 +- packages/ui/src/prompts.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/calculator/src/index.tsx b/examples/calculator/src/index.tsx index 852911990..328248060 100644 --- a/examples/calculator/src/index.tsx +++ b/examples/calculator/src/index.tsx @@ -85,7 +85,7 @@ function safeEval(expr: string): string { if (tokens.length === 0) return '0'; // Handle initial negative number - if (tokens[0] === '-' && tokens.length > 1 && !isNaN(Number(tokens[1]))) { + if (tokens[0] === '-' && tokens.length > 1 && !Number.isNaN(Number(tokens[1]))) { tokens.splice(0, 2, '-' + tokens[1]); } diff --git a/examples/widget-gallery/src/index.ts b/examples/widget-gallery/src/index.ts index 57b141244..ec688a7fc 100644 --- a/examples/widget-gallery/src/index.ts +++ b/examples/widget-gallery/src/index.ts @@ -129,7 +129,7 @@ class WidgetGalleryApp extends Widget { } // Tab switching: 1-6 - const num = parseInt(event.key); + const num = parseInt(event.key, 10); if (num >= 1 && num <= 6) { this._switchTab(num - 1); return true; diff --git a/packages/ui/src/prompts.ts b/packages/ui/src/prompts.ts index b92bb28ba..06a6845f0 100644 --- a/packages/ui/src/prompts.ts +++ b/packages/ui/src/prompts.ts @@ -69,7 +69,7 @@ async function promptText(options: TextPromptOptions): Promise { async function promptConfirm(options: ConfirmPromptOptions): Promise { if (!process.stdin.isTTY) throw new NonInteractiveError(); - const hint = options.default === true ? 'Y/n' : options.default === false ? 'y/N' : 'y/n'; + const hint = options.default ? 'Y/n' : options.default === false ? 'y/N' : 'y/n'; return new Promise((resolve) => { const rl = readline.createInterface({