Skip to content

[TS-01] No strictNullChecks: ~65 type annotations lie, hiding null-safety bugs at runtime #6

Description

@mairas

Severity: high | Confidence: confirmed | Area: type-safety | Source: codebase review 2026-06-30, finding TS-01

Problem

Neither tsconfig.json nor any extended config (src/tsconfig.app.json, src/tsconfig.spec.json) enables strict, strictNullChecks, noImplicitAny, or strictPropertyInitialization. The only strictness options present are Angular-specific template checks (strictTemplates and strictInjectionParameters). As a result, approximately 65 non-test declarations annotate a non-nullable type such as string or number while being initialised to null — for example let currentValue: string = null and private serverEndpoint: string = null. TypeScript silently accepts these, so the annotations actively misrepresent the runtime state: a variable typed string legitimately holds null, and every downstream operation that trusts the annotation (string methods, arithmetic, comparisons) can fail at runtime without any compile-time warning.

Impact

In a marine dashboard context, Signal K data paths frequently emit null on timeout, sensor loss, or initialisation. Without strictNullChecks, the type system provides zero protection at those boundaries: null values flow through code annotated as non-nullable, reaching operations that assume a valid string or number, which can produce silent NaN results, TypeError exceptions, or corrupt display values. For a fork targeting long-term reliability in a safety-relevant marine environment, enabling strict null checking would surface real latent bugs mechanically rather than requiring manual audit.

Affected code

  • tsconfig.json:1-26
  • src/tsconfig.app.json
  • src/tsconfig.spec.json
  • src/app/core/services/data.service.ts:247-248
  • src/app/core/services/storage.service.ts:39-43
  • src/app/core/services/signalk-delta.service.ts:58
  • src/app/widgets/minichart/minichart.component.ts:39-48

Suggested direction

Enable strictNullChecks incrementally: introduce a tsconfig.strict.json that extends the base config and enables strictNullChecks, wire it into CI as a ratchet (fail on regression, do not require 100% compliance on day one), then work through the ~65 lying annotations changing them to proper union types (string | null, number | null, etc.). Once that is clean, enable the remaining strict flags and add noImplicitReturns and noFallthroughCasesInSwitch. This approach is largely mechanical and surfaces real data-flow bugs rather than introducing new behaviour.

Verification

Verified against the codebase: all four cited = null declarations confirmed verbatim; repo-wide grep of all tsconfig*.json and angular.json found only strictTemplates and strictInjectionParameters — no strict, strictNullChecks, noImplicitAny, or strictPropertyInitialization anywhere (confidence: confirmed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:type-safetyType safety & maintainabilitybugSomething isn't workingkip-reviewFrom the 2026-06-30 Kip/SKip codebase reviewseverity:highReview finding: high severity

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions