Skip to content

Eliminate Unsafe 'any' Type Usage Across the Codebase #37

@pragmaticAweds

Description

@pragmaticAweds

Context & Impact

Multiple files use TypeScript any type, bypassing the type system entirely. Examples include CheckCircle2(props: any) in the offramp page, setTypeFilter(v as any) in the history page, error: any in the wallet provider, and data?: any in several components. Each any is a potential runtime crash that TypeScript can no longer catch at compile time.

Why this matters: TypeScript's entire value is catching bugs at compile time. Every any is a hole in that safety net. In a financial application where incorrect types could mean sending tokens to the wrong address or displaying wrong amounts, type safety is not optional — it's critical infrastructure.

Scope

  • Audit all any type usage in apps/web/src/
  • Replace each any with the correct specific type
  • Fix type errors that surface after replacing any (these are real bugs being hidden)
  • Enable stricter TypeScript settings to prevent future any usage
  • Add @typescript-eslint/no-explicit-any ESLint rule

Implementation Guidelines

  • Search for : any, as any, and <any> across the codebase
  • For error: any in catch blocks, use unknown and narrow with type guards
  • For component props, define proper interfaces
  • For API responses, define response types matching the actual data shape
  • For as any casts, determine the correct type and fix the underlying type mismatch
  • Do not replace any with unknown everywhere — find the real type

Acceptance Criteria

  • Zero any type annotations remain in apps/web/src/ (excluding auto-generated files)
  • All as any casts are replaced with properly typed code
  • Catch blocks use unknown with proper type narrowing
  • All component props have defined interfaces
  • @typescript-eslint/no-explicit-any rule is added to ESLint config as error
  • pnpm build passes with no type errors
  • No new runtime errors are introduced by the type fixes

Getting Started

  1. Run grep -rn "any" apps/web/src/ --include="*.ts" --include="*.tsx" | grep -v node_modules | grep -v test to find all instances
  2. Start with src/providers/StellarWalletProvider.tsx — replace error: any with unknown
  3. Fix src/app/(overview)/offramp/page.tsx — type the CheckCircle2 props properly
  4. Fix src/app/(overview)/history/page.tsx — remove as any cast on setTypeFilter
  5. Work through remaining files systematically
  6. Add @typescript-eslint/no-explicit-any to eslint.config.mjs
  7. Run pnpm build after each file to catch issues early

PR Submission Guide

This section applies to every PR for this issue. Follow it exactly.

Before You Start

  • Pull the latest main branch: git checkout main && git pull origin main
  • Create your feature branch from main: git checkout -b fix/<issue-number>-remove-any-types

While Working

  • Make atomic commits — one concern per commit, each commit must build
  • Use Conventional Commits: feat(scope): description, fix(scope): description
  • Keep your branch up to date: git pull origin main --rebase regularly

Before Submitting the PR

  • Pull latest main and rebase: git checkout main && git pull origin main && git checkout <your-branch> && git rebase main
  • Ensure the build passes: pnpm build
  • Ensure linting passes: pnpm lint
  • Record a screen recording of your implementation showing the feature/fix working in the browser. Attach it to the PR.

PR Requirements

  • Link this issue in your PR description using Closes #<issue-number>
  • Fill out the full PR template — Summary, What Was Implemented, Implementation Details, How to Test
  • Attach your screen recording demonstrating the implementation
  • Request a review from a maintainer

PRs without a screen recording or without a linked issue will not be reviewed. Failure to meet PR requirements may lead to PR rejection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions