mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix(desktop): make compact tool label map type honest
The labels Record was annotated Record<CompactToolKind, ...> but only spreads generic + developerToolLabels(), which excludes the buzz kind. buzz is handled by an early return in compactToolLabel, so it never indexes this map. Narrow the annotation to Exclude<CompactToolKind, "buzz"> so tsc accepts it, and drop the redundant labelsMap re-cast. No runtime behavior change. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
co-authored by
Taylor Ho
parent
9f65106822
commit
781a286338
@@ -131,7 +131,7 @@ function compactToolLabel(
|
||||
}
|
||||
|
||||
const labels: Record<
|
||||
CompactToolKind,
|
||||
Exclude<CompactToolKind, "buzz">,
|
||||
{ completed: string; running: string; failed: string }
|
||||
> = {
|
||||
generic: {
|
||||
@@ -142,12 +142,7 @@ function compactToolLabel(
|
||||
...developerToolLabels(),
|
||||
};
|
||||
|
||||
const labelsMap = labels as Record<
|
||||
CompactToolKind,
|
||||
{ completed: string; running: string; failed: string }
|
||||
>;
|
||||
|
||||
const set = labelsMap[kind];
|
||||
const set = labels[kind];
|
||||
if (failed) return set.failed;
|
||||
if (running) return set.running;
|
||||
return set.completed;
|
||||
|
||||
Reference in New Issue
Block a user