Skip to content

Spec: strict TypeScript #406

Done
4 of 4 issues completed
Done

Description

@jtklein-agents

Problem Statement

tsconfig.json runs with "strict": false and five strict flags turned on one by one. The rest of strict mode is off: strictNullChecks and strictFunctionTypes would flag 149 places today. Those include places where the code reads a value that can be missing (an alignment's data type before parsing, a regex match after a test) and places where a component accepts a setter of the wrong value type. Nothing in CI stops new code adding more.

Solution

The app behaves as it does now. Underneath, tsconfig.json sets "strict": true and drops the flags strict covers, and yarn typecheck passes with no new @ts-ignore or @ts-expect-error. Test files are held to strict mode too. Real bugs that strict mode exposes and whose fix changes what the user sees are filed as their own bug issues, not fixed here.

User Stories

  1. As a developer, I want the typecheck to reject reading a value that may be missing, so that "Cannot read properties of undefined" crashes are caught before release.
  2. As a developer, I want an option component to accept only a store option of the value type it renders, so that a number option can't silently receive a string.
  3. As a developer, I want test files under the same compiler rules as the code they test, so that fixtures can't hide null-shaped bugs.
  4. As a person using raxmlGUI, I want nothing to change, so that this cleanup costs me nothing.

Implementation Decisions

Each decision lives on its ticket under Map: strict TypeScript:

Production code narrows for real and uses ! only with a one-line comment giving the reason; tests may use !. One tsconfig; no typescript-strict-plugin.

Testing Decisions

  • The changes are type-only: no new tests. Every child passes yarn verify.
  • While strictNullChecks is off, a child proves itself with tsc --noEmit -p tsconfig.json --strict run before and after: zero errors in the non-test files it owns, and a total that does not rise. Both counts go in the PR description.
  • The last child turns strict on, so CI's yarn typecheck becomes the check from then on.

Out of Scope

noUncheckedIndexedAccess, exactOptionalPropertyTypes and other flags beyond strict; enforcing the ! rule with @typescript-eslint/no-non-null-assertion; generic OptionTextField/OptionCheck; a shared test factory for store parents; behavior fixes for bugs strict mode exposes, such as Applying a modeltest result with an unlisted protein matrix throws a TypeError.

Further Notes

Starting point at 2dbadc8: 149 errors under --strict. Order: the three production children run in parallel; the tests child waits on all three.

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions