Fix unsafe frontend casts and mark Task 18 done
This commit is contained in:
@@ -408,6 +408,8 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
|
|||||||
|
|
||||||
**Docs changes needed:** None.
|
**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.
|
**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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ export function useDashboardCountryData(
|
|||||||
if (controller.signal.aborted) return;
|
if (controller.signal.aborted) return;
|
||||||
setCountries(data.countries);
|
setCountries(data.countries);
|
||||||
setCountryNames(data.country_names);
|
setCountryNames(data.country_names);
|
||||||
// MapBanItem and DashboardBanItem are structurally identical.
|
setBans(data.bans);
|
||||||
setBans(data.bans as DashboardBanItem[]);
|
|
||||||
setTotal(data.total);
|
setTotal(data.total);
|
||||||
})
|
})
|
||||||
.catch((err: unknown) => {
|
.catch((err: unknown) => {
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import { useRunImport } from "../hooks/useBlocklist";
|
|||||||
import { ImportResultDialog } from "./blocklists/ImportResultDialog";
|
import { ImportResultDialog } from "./blocklists/ImportResultDialog";
|
||||||
|
|
||||||
export function BlocklistsPage(): React.JSX.Element {
|
export function BlocklistsPage(): React.JSX.Element {
|
||||||
const safeUseBlocklistStyles = useBlocklistStyles as unknown as () => { root: string };
|
const styles = useBlocklistStyles();
|
||||||
const styles = safeUseBlocklistStyles();
|
|
||||||
const { running, lastResult, error: importError, runNow } = useRunImport();
|
const { running, lastResult, error: importError, runNow } = useRunImport();
|
||||||
const [importResultOpen, setImportResultOpen] = useState(false);
|
const [importResultOpen, setImportResultOpen] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
ToolbarButton,
|
ToolbarButton,
|
||||||
TableColumnDefinition,
|
|
||||||
createTableColumn,
|
createTableColumn,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
tokens,
|
tokens,
|
||||||
} from "@fluentui/react-components";
|
} from "@fluentui/react-components";
|
||||||
|
import type { TableColumnDefinition } from "@fluentui/react-components";
|
||||||
import {
|
import {
|
||||||
ArrowCounterclockwiseRegular,
|
ArrowCounterclockwiseRegular,
|
||||||
ChevronLeftRegular,
|
ChevronLeftRegular,
|
||||||
|
|||||||
Reference in New Issue
Block a user