From 852d691b786096490f28bcb65bf57340704148c8 Mon Sep 17 00:00:00 2001 From: chioarub Date: Tue, 2 Jun 2026 22:18:03 +0300 Subject: [PATCH] fix(typecheck): narrow hook event counts --- src/components/hooks/HooksConfigMenu.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/hooks/HooksConfigMenu.tsx b/src/components/hooks/HooksConfigMenu.tsx index 61fc0a2613..ff095fcdd9 100644 --- a/src/components/hooks/HooksConfigMenu.tsx +++ b/src/components/hooks/HooksConfigMenu.tsx @@ -49,6 +49,10 @@ type ModeState = { event: HookEvent; hook: IndividualHookConfig; }; +type HooksByEventAndMatcher = Record< + HookEvent, + Record +>; export function HooksConfigMenu(t0) { const $ = _c(100); const { @@ -106,7 +110,7 @@ export function HooksConfigMenu(t0) { } else { t4 = $[7]; } - const hooksByEventAndMatcher = t4; + const hooksByEventAndMatcher: HooksByEventAndMatcher = t4; let t5; if ($[8] !== hooksByEventAndMatcher || $[9] !== selectedEvent) { t5 = getSortedMatchersForEvent(hooksByEventAndMatcher, selectedEvent); @@ -259,7 +263,7 @@ export function HooksConfigMenu(t0) { const hooksDisabled_1 = settings_1?.disableAllHooks === true; let t20; if ($[33] !== hooksByEventAndMatcher) { - const byEvent = {}; + const byEvent: Partial> = {}; let total = 0; for (const [event_0, matchers] of Object.entries(hooksByEventAndMatcher)) { const eventCount = Object.values(matchers).reduce(_temp5, 0); @@ -559,7 +563,7 @@ export function HooksConfigMenu(t0) { function _temp6() { return Esc to close; } -function _temp5(sum, hooks) { +function _temp5(sum: number, hooks: IndividualHookConfig[]): number { return sum + hooks.length; } function _temp4(tool) {