Skip to content

Enable strict TypeScript mode in backend tsconfig #166

Description

@Josie123-Dev

What

Enable strictNullChecks, noImplicitAny, strictBindCallApply, forceConsistentCasingInFileNames, and noFallthroughCasesInSwitch in backend/tsconfig.json. Fix all resulting type errors across the backend codebase.

Why

The backend currently runs with nearly all strict TypeScript checks disabled (strictNullChecks: false, noImplicitAny: false). For a platform handling encrypted health credentials and vaccination records, implicit any types and unchecked nulls are a liability — they hide bugs that could lead to data corruption, unauthorized access, or silent failures in credential verification flows.

The frontend already has "strict": true. The backend should match.

Scope

In scope:

  • Set all strict-family flags to true in backend/tsconfig.json
  • Fix every resulting compilation error (expect ~50-150 fixes across 19 modules)
  • Replace @ts-ignore in app.module.ts:62 with proper typing for the Redis cache store
  • Ensure npm run build passes with zero errors after changes

Out of scope:

  • Refactoring module architecture
  • Adding new features
  • Changing runtime behavior

Acceptance Criteria

  • backend/tsconfig.json has "strict": true (or all individual strict flags enabled)
  • npm run build in backend/ completes with zero TypeScript errors
  • npm run test in backend/ passes all existing tests
  • No @ts-ignore or @ts-nocheck comments remain
  • PR includes a summary of the types of fixes applied

Technical Context

  • Config file: backend/tsconfig.json
  • The @ts-ignore at backend/src/app.module.ts:62 is for a Redis cache store type — use @nestjs/cache-manager types or a proper type assertion
  • NestJS 10 supports strict mode well; most fixes will be null checks and explicit type annotations
  • Run npx tsc --noEmit to see all errors before fixing

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbackendBackend related issuesdifficulty:hardHard difficulty issuespriority:highHigh priority issuesqualityCode quality improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions