Skip to content

[HIGH] Replace any types with proper TypeScript types across codebase #24

Description

@kilodesodiq-arch

Engineering Gap

48+ instances of any type across backend and frontend bypassing TypeScript type safety. Concentrated in error handlers, Prisma interactions, guard implementations, and onchain adapter. @typescript-eslint/no-explicit-any globally disabled in .eslintrc.js line 15.

Codebase Evidence

  • .eslintrc.js line 15: @typescript-eslint/no-explicit-any: off — globally disabled
  • app/backend/src/common/filters/http-exception.filter.ts: 6 instances (exception: any, details: any, etc.)
  • app/backend/src/onchain/soroban.adapter.ts: 5 instances (result: any, scv: any, receipt: any, status: any)
  • app/backend/src/common/guards/adaptive-rate-limit.guard.ts: 2 instances (request: any)
  • app/backend/src/onchain/interfaces/onchain-job.interface.ts: params: any in core job type
  • app/frontend/src/components/ActivityCenter.tsx, useActivity.ts: any in callback signatures

Risk Profile

Current Risk

Runtime type errors in production. Reduced IDE support. Hidden bugs from unchecked property access. Refactoring breaks silently.

Business Impact

Higher bug rate. Slower development velocity. Reduced code review effectiveness. Production incidents from type coercion errors.

Remediation Strategy

Prioritize safety-critical paths first (onchain adapter, error handlers, guards). Define proper interfaces. Enable @typescript-eslint/no-explicit-any as warn, then error, with targeted suppressions. Add to CI lint gate.

Success Conditions

  • All any types in onchain, auth, and guards replaced
  • Proper interfaces defined for Prisma return types
  • no-explicit-any enabled as error with justified suppressions
  • CI lint gate enforces

Change Surface

Files: 20+ across backend and frontend source

Security Review

Type safety reduces injection and coercion vulnerabilities. Net positive.

Completion Checklist

  • Implementation completed
  • Peer reviewed
  • Tests passing
  • CI lint passing
  • Ready for merge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions