diff --git a/Docs/Tasks.md b/Docs/Tasks.md index 79f3ff1..5a724b1 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -408,6 +408,8 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue. **Docs changes needed:** None. +**Status:** Completed. + **Why this is needed:** `as unknown as T` is the TypeScript equivalent of `any` — it silences the type checker without any safety guarantee. If the actual runtime value does not match `T`, the error is deferred to a cryptic downstream failure. The `import type` issue is a code hygiene violation — it prevents tree-shaking tools from safely dropping type-only imports and misleads readers into thinking a type has a runtime value. --- diff --git a/frontend/src/hooks/useDashboardCountryData.ts b/frontend/src/hooks/useDashboardCountryData.ts index 3c9e625..029033d 100644 --- a/frontend/src/hooks/useDashboardCountryData.ts +++ b/frontend/src/hooks/useDashboardCountryData.ts @@ -73,8 +73,7 @@ export function useDashboardCountryData( if (controller.signal.aborted) return; setCountries(data.countries); setCountryNames(data.country_names); - // MapBanItem and DashboardBanItem are structurally identical. - setBans(data.bans as DashboardBanItem[]); + setBans(data.bans); setTotal(data.total); }) .catch((err: unknown) => { diff --git a/frontend/src/pages/BlocklistsPage.tsx b/frontend/src/pages/BlocklistsPage.tsx index 2874b28..f20bd4e 100644 --- a/frontend/src/pages/BlocklistsPage.tsx +++ b/frontend/src/pages/BlocklistsPage.tsx @@ -14,8 +14,7 @@ import { useRunImport } from "../hooks/useBlocklist"; import { ImportResultDialog } from "./blocklists/ImportResultDialog"; export function BlocklistsPage(): React.JSX.Element { - const safeUseBlocklistStyles = useBlocklistStyles as unknown as () => { root: string }; - const styles = safeUseBlocklistStyles(); + const styles = useBlocklistStyles(); const { running, lastResult, error: importError, runNow } = useRunImport(); const [importResultOpen, setImportResultOpen] = useState(false); diff --git a/frontend/src/pages/HistoryPage.tsx b/frontend/src/pages/HistoryPage.tsx index e37da6a..6f7bf31 100644 --- a/frontend/src/pages/HistoryPage.tsx +++ b/frontend/src/pages/HistoryPage.tsx @@ -19,11 +19,11 @@ import { Text, Toolbar, ToolbarButton, - TableColumnDefinition, createTableColumn, makeStyles, tokens, } from "@fluentui/react-components"; +import type { TableColumnDefinition } from "@fluentui/react-components"; import { ArrowCounterclockwiseRegular, ChevronLeftRegular,