Skip to content

build(srcts): Turn on TypeScript strict mode - #154

Merged
schloerke merged 1 commit into
schloerke/typescript-docsfrom
schloerke/typescript-strict
Oct 20, 2026
Merged

schloerke merged 1 commit into
schloerke/typescript-docsfrom
schloerke/typescript-strict

Conversation

@schloerke

@schloerke schloerke commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Turns on strict in tsconfig.json and fixes the 40 errors it reports. Most are missing types on local variables and callback parameters, and functions that said they always return a value when they can return undefined. StatusArr.last() is one example: a caller read .action from it with no check. Fields that GraphAtStep fills in from its init methods are marked with !. Two small helpers became standard library calls: utils/ArrayHelper.ts is now Array#flatMap, and utils/queryString.ts is now URLSearchParams. The timeline now gets the click position from the native mouse event.

I checked it by loading the main bundle and this bundle in Chrome and doing the same 18 things in each: every nav button, the arrow keys, Home and End, a click on the timeline, and a search. I also clicked and double-clicked a node and the background. The step, the node and edge counts, the log entry text, and the sticky and filter state matched every time, and neither page threw an error.

no-explicit-any is still off, so the any types left over from Flow's Object are not checked yet. The docs (AGENTS.md, memory-bank/jsBuild.md, memory-bank/viewerUi.md) are updated to match.

Fix the 40 errors strict mode reports:

- Type the untyped locals and callback parameters.
- Return `T | undefined` from StatusArr.remove()/last() and the Node
  wrappers, and use `?.` where the last status may be missing.
- Walk the ancestor and descendant ids without reassigning a
  `string | null` variable.
- Mark GraphAtStep fields set by its init methods with `!`.
- Read the timeline position from the native mouse event.
- Replace utils/ArrayHelper.ts with Array#flatMap and
  utils/queryString.ts with URLSearchParams.
@schloerke
schloerke added this pull request to stack #153 October 20, 2026 18:07
@schloerke
schloerke merged commit 7eac3e5 into main Oct 20, 2026
25 checks passed
@schloerke
schloerke deleted the schloerke/typescript-strict branch October 20, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant