-
Notifications
You must be signed in to change notification settings - Fork 57
Add TypeScript strict mode to both client and backend tsconfig #175
Copy link
Copy link
Open
Labels
BackendStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programdxDeveloper experienceDeveloper experiencefrontendClient/frontend relatedClient/frontend related
Description
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 bugsstrictFunctionTypes— proper function type variancestrictBindCallApply— type-safe bind/call/applystrictPropertyInitialization— catches uninitialized class fieldsnoImplicitAny— 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: trueenabled in both tsconfigs - All null/undefined errors resolved (no
!.non-null assertions on untrusted data) -
noImplicitAny: trueenabled - TypeScript compilation still passes in CI after changes
- Remaining strict violations tracked as issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BackendStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programdxDeveloper experienceDeveloper experiencefrontendClient/frontend relatedClient/frontend related