From b1424a5bea375d4a94ec093f93af28c30da6d99b Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Mon, 16 Nov 2026 10:54:12 +0100 Subject: [PATCH] Type health tone so the fallback is gone Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WzxdWYNS1qAMRdgAtbr5Rq --- web/src/shell/health.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/shell/health.ts b/web/src/shell/health.ts index 0b149f7..f85cf18 100644 --- a/web/src/shell/health.ts +++ b/web/src/shell/health.ts @@ -10,14 +10,14 @@ import { errorNotice, glyph } from '../ui/build' import { ServerRestart } from './serverRestart' const DAEMON_TONE = { running: 'success', restarting: 'warning', unreachable: 'danger' } as const -const STATE_ICON: Record = { success: 'health.ok', warning: 'health.warn', danger: 'health.bad', neutral: 'health.unknown' } +const STATE_ICON = { success: 'health.ok', warning: 'health.warn', danger: 'health.bad', neutral: 'health.unknown' } as const satisfies Record /** A health pill: the subject and state icons painted, `text` (+ `extra`) spoken. `data-state` holds the words for tests. */ -function badge(tone: string, subject: IconId, text: string, extra = ''): HTMLSpanElement { +function badge(tone: keyof typeof STATE_ICON, subject: IconId, text: string, extra = ''): HTMLSpanElement { return h( 'span', { class: `pill pill-${tone}`, 'data-state': text }, - h('span', { class: 'has-word', 'aria-hidden': 'true' }, iconInline(subject), iconInline(STATE_ICON[tone] ?? 'health.unknown')), + h('span', { class: 'has-word', 'aria-hidden': 'true' }, iconInline(subject), iconInline(STATE_ICON[tone])), h('span', { class: 'sr-only' }, text + extra), ) }