Skip to content

Replace 45 as-any casts in src/components: props and event payloads bypass type checks #866

Description

@nanaf6203-bit

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

  1. 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.
  2. 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.
  3. 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/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Medium ComplexityStellar WaveIssues in the Stellar wave programbugSomething isn't working correctly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions