Skip to content

Types: Add Zod schemas for API responses and critical props #63

@andrejvysny

Description

@andrejvysny

Context
Issue #38 requests type guards and runtime validation. The project already depends on zod. Many pages rely on server-provided props via Inertia without runtime validation.

Scope

  • Define Zod schemas for key API responses and Inertia page props (e.g., transactions/index, analytics, imports)
  • Validate data at entry points (page props/hook responses) and narrow types accordingly
  • Provide a small helper to log/report schema mismatches in development

Affected files

  • resources/js/types (add schemas)
  • resources/js/pages/** (apply parsing where data enters components)
  • resources/js/lib/zod-helpers.ts (new)

Acceptance criteria

  • Zod schemas exist for at least 3 core pages (transactions, analytics, imports)
  • Parsing applied once at page boundary; downstream components receive narrowed types
  • No runtime exceptions on valid data; mismatches log useful messages in dev
  • Link back to P3: Optimize Frontend Architecture and Performance #38

Labels
area:frontend, area:types, type:enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions