Skip to content

Add TypeScript strict mode to both client and backend tsconfig #175

@Calebux

Description

@Calebux

Description

Neither /backend/tsconfig.json nor /client/tsconfig.json enables TypeScript strict mode. Without strict mode, common bugs like null/undefined dereferences, implicit any parameters, and uninitialized class properties go undetected at compile time.

Current State

// tsconfig.json (likely)
{
  "compilerOptions": {
    "strict": false  // or not set
  }
}

Fix

Enable strict mode

{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true
  }
}

The strict flag enables:

  • strictNullChecks — catches null/undefined bugs
  • strictFunctionTypes — proper function type variance
  • strictBindCallApply — type-safe bind/call/apply
  • strictPropertyInitialization — catches uninitialized class fields
  • noImplicitAny — forces explicit types

Migration Strategy (incremental)

Enabling strict on a large codebase will produce many errors. Use incremental migration:

Step 1: Enable strictNullChecks only

Fix all null/undefined errors first. This has the highest ROI for bug prevention.

Step 2: Enable noImplicitAny

Fix all implicit any types.

Step 3: Enable full strict: true

For each step: use // @ts-expect-error with a TODO comment for errors you can't fix immediately, tracking them as tech debt.

Why This Matters for SYNCRO

The subscription service currently uses any types extensively. With strictNullChecks, the compiler would have caught potential null dereferences on subscription fields before they cause runtime errors.

Acceptance Criteria

  • strictNullChecks: true enabled in both tsconfigs
  • All null/undefined errors resolved (no !. non-null assertions on untrusted data)
  • noImplicitAny: true enabled
  • TypeScript compilation still passes in CI after changes
  • Remaining strict violations tracked as issues

Metadata

Metadata

Assignees

Labels

BackendStellar WaveIssues in the Stellar wave programdxDeveloper experiencefrontendClient/frontend related

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions