Skip to content

[Feature] Null/undefined disambiguation rule enforced via lint #271

Description

@pathosDev

Size / Priority

Status — overlaps with #258

This issue and #258 describe the same problem from slightly different angles:

Recommend implementing as one coordinated change: define the rule (#258) + enforce it via strictNullChecks + audit pass (#271). Track as the same effort.

Rationale

TypeScript's strictNullChecks and noUncheckedIndexedAccess would catch many latent bugs caused by inconsistent null/undefined handling:

  • map.get(key) returns T | undefined under strict; many sites assume T.
  • Function returns typed X | null but caller uses result.foo without checking.

Effects of enabling strict mode:

  • Compile errors at many sites; each one is a real possible bug.
  • Forces the developer to handle the absence case explicitly.

Implementation

  1. Enable strictNullChecks (likely already on) + noUncheckedIndexedAccess (likely off).
  2. Audit each compile error:
    • Genuine bug → fix (add guard, change return type).
    • False positive → narrow with type guard or non-null assertion (with comment justifying).
  3. Settle the public-API shape (per [Feature] Codebase-wide null/undefined disambiguation rule (Option<X> for public API) #258).

Integration / risk

  • Significant compile-error churn upfront.
  • Each fix is small but the total volume is large.

Test plan

  1. Enable strict mode; run tsc.
  2. Fix each error.
  3. Full test suite passes.

Acceptance criteria

Pre-implementation note

Pair with #258 for one coordinated effort. Significant work — multi-week.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions