From 47cfc5be6ce6675dd17edc95a8721bd31bb93c7e Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Tue, 21 Jul 2026 14:10:13 +0200 Subject: [PATCH] fix: resolve lint errors - non-null assertions and function scoping --- packages/widgets/src/downloads/component.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/widgets/src/downloads/component.tsx b/packages/widgets/src/downloads/component.tsx index 041495bc9..d2b3b5f28 100644 --- a/packages/widgets/src/downloads/component.tsx +++ b/packages/widgets/src/downloads/component.tsx @@ -205,8 +205,9 @@ export default function DownloadClientsWidget({ const aVal = a[accessor] ?? 0; const bVal = b[accessor] ?? 0; if (accessor === "time") { - const toKey = (time: number) => (time === 0 ? Infinity : time); - return (toKey(aVal as number) - toKey(bVal as number)) * dir; + const aTime = (aVal as number) === 0 ? Infinity : (aVal as number); + const bTime = (bVal as number) === 0 ? Infinity : (bVal as number); + return (aTime - bTime) * dir; } if (typeof aVal === "string" && typeof bVal === "string") return aVal.localeCompare(bVal) * dir; if (typeof aVal === "number" && typeof bVal === "number") return (aVal - bVal) * dir; @@ -862,7 +863,7 @@ function RowContextMenu({ state, onClose, t }: { : } - onClick={() => { (isPaused ? item.actions!.resume : item.actions!.pause)(); onClose(); }} + onClick={() => { (isPaused ? item.actions?.resume : item.actions?.pause)?.(); onClose(); }} > {t(`actions.item.${isPaused ? "resume" : "pause"}`)} @@ -880,14 +881,14 @@ function RowContextMenu({ state, onClose, t }: { } - onClick={() => { item.actions!.delete({ fromDisk: false }); onClose(); }} + onClick={() => { item.actions?.delete({ fromDisk: false }); onClose(); }} > {t("actions.item.delete.entry")} } - onClick={() => { item.actions!.delete({ fromDisk: true }); onClose(); }} + onClick={() => { item.actions?.delete({ fromDisk: true }); onClose(); }} > {t("actions.item.delete.entryAndFiles")}