Skip to content

Conversation

@jeremyeder
Copy link
Contributor

Summary

This PR adds comprehensive TypeScript type-checking infrastructure to prevent type errors from reaching production.

TypeScript Errors Fixed (88 → 0)

  • React Query hooks (60 errors): Added generic type parameters, replaced deprecated cacheTime with gcTime
  • Axios client (9 errors): Fixed type assertions for config objects
  • Router navigation (3 errors): Corrected route paths (/notifications//notifications, etc.)
  • User types (4 errors): Added missing username field
  • Component types (12 errors): Fixed data access patterns, theme context, removed invalid props
  • AdminGuard import: Fixed path from non-existent authContext to useAuth hook

Infrastructure Added

Pre-commit Type-Checking ✅

  • Created scripts/type-check-if-ts.sh - only runs when .ts/.tsx files are staged
  • Updated package.json lint-staged config
  • Performance impact:
    • Non-TypeScript commits: ~2-3 seconds (no change)
    • TypeScript file commits: ~8-30 seconds (includes type-checking)

GitHub Actions CI Workflow ✅

  • Created .github/workflows/ci.yaml
  • Validates all PRs with:
    • TypeScript type-check (npm run type-check)
    • ESLint validation (npm run lint)
    • Prettier format check (npm run format:check)
    • Test suite (npm run test)
  • Runs on PRs to main and direct pushes

Documentation ✅

  • Updated CLAUDE.md with type safety section
    • Pre-commit hook behavior and performance impact
    • CI/CD pipeline requirements
    • How to bypass hooks (not recommended)

Test Plan

  • All 88 TypeScript errors resolved: npm run type-check shows 0 errors
  • Pre-commit hook runs successfully on TS file commits
  • Pre-commit hook skips type-check for non-TS commits
  • Commit includes all necessary files (script, workflow, config, docs)
  • CI workflow passes on this PR (will validate automatically)

Breaking Changes

None - this is purely additive infrastructure.

Migration Notes

Developers will now see type-checking in pre-commit hooks when committing TypeScript files. This adds ~8-30 seconds to TypeScript commits but provides fast feedback before pushing.

To bypass (not recommended):

git commit --no-verify

🤖 Generated with Claude Code

- Fixed all 88 TypeScript errors across the codebase
  - React Query hooks: Added generic type parameters, replaced deprecated cacheTime with gcTime
  - Axios client: Fixed type assertions for config objects
  - Router navigation: Corrected route paths
  - User types: Added missing username field
  - Component types: Fixed data access patterns and theme context
  - AdminGuard: Fixed import path from non-existent authContext to useAuth hook

- Added pre-commit type-checking (runs only when TS files are staged)
  - Created scripts/type-check-if-ts.sh for conditional type-checking
  - Updated lint-staged config in package.json
  - Performance: 2-3s for non-TS commits, 8-30s for TS commits

- Added GitHub Actions CI workflow
  - Validates all PRs with type-check, lint, format-check, and tests
  - Runs on pull requests to main and direct pushes

- Updated CLAUDE.md with type safety documentation
  - Pre-commit hook behavior and performance impact
  - CI/CD pipeline requirements
  - How to bypass hooks (not recommended)

This ensures type errors are caught before they reach production and
provides fast feedback during development.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jeremyeder jeremyeder merged commit 331e27d into main Dec 8, 2025
1 check failed
@jeremyeder jeremyeder deleted the feature/type-checking-infrastructure branch December 8, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants