You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace 45 as-any casts in src/components: props and event payloads bypass type checks
Labels / Complexity: bug · Medium Complexity — Medium
Problem
src/components/ contains 45 as any casts (verified by grep), the second-highest directory after src/utils (116). The casts appear in props, event handlers, and data passed between components — the exact interfaces that change when a prop or payload is renamed.
Component contract drift compiles silently. A renamed prop or reshaped event payload type-checks through as any and breaks at runtime, often as a confusing render failure.
The casts cluster in the dashboard and property components where data flows from services into charts and forms — the surfaces most likely to change shape as the mock data (issue14 #20, Mobile-First Property Viewing Experience #21) is replaced with real data.
Why this is architecturally hard
The real types exist or must be declared. Most casts sit next to types that are already declared (@/types/property, chart data shapes); the fix is threading the declared types through, which surfaces the places where components genuinely disagree with their data sources.
Some casts are chart-library workarounds. Charting libs (recharts-style) often have loose payload types; those need a typed adapter, not a bare cast — a small design decision per chart family.
The mock-data migrations depend on this. When issue14 #20/Mobile-First Property Viewing Experience #21 replace mock constants with real data, the cast sites are where the shape mismatch will surface; fixing the casts first makes those migrations safe.
Acceptance criteria
All as any casts in src/components/ are replaced with real types or typed adapters.
npx tsc --noEmit passes; npm test passes with no behavior change.
The PR reports the repository-wide as any count before and after.
Out of scope
as any in src/utils (tracked separately); the mock-data migrations (#20, #21).
Getting started
grep -rn "as any" src/components --include=*.tsx — the sites
src/types/ — the shared type declarations
Commands: npx tsc --noEmit, npm test.
Good first files to read: src/components/dashboard/, src/types/.
Replace 45 as-any casts in src/components: props and event payloads bypass type checks
Labels / Complexity: bug · Medium Complexity — Medium
Problem
src/components/contains 45as anycasts (verified by grep), the second-highest directory aftersrc/utils(116). The casts appear in props, event handlers, and data passed between components — the exact interfaces that change when a prop or payload is renamed.as anyand breaks at runtime, often as a confusing render failure.Why this is architecturally hard
@/types/property, chart data shapes); the fix is threading the declared types through, which surfaces the places where components genuinely disagree with their data sources.Acceptance criteria
as anycasts insrc/components/are replaced with real types or typed adapters.npx tsc --noEmitpasses;npm testpasses with no behavior change.as anycount before and after.Out of scope
as anyinsrc/utils(tracked separately); the mock-data migrations (#20, #21).Getting started
grep -rn "as any" src/components --include=*.tsx— the sitessrc/types/— the shared type declarationsCommands:
npx tsc --noEmit,npm test.Good first files to read:
src/components/dashboard/,src/types/.