Skip to content

Map: page to TypeScript #225

Closed
8 of 8 issues completed
Closed

Description

@jtklein-agents

Destination

A spec issue, "Spec: page TypeScript", with a feature branch and child leaf tickets, the same shape as the main-process TypeScript spec. The map is done when that spec and its leaves can be written with nothing left to decide. The map converts no files.

Notes

  • In scope: production files under src/app (panels, page store, helpers, entry), src/preload/index.js, and the three src/common parsers (fastaParser.js, phylipParser.js, typecheckAlignment.js). About 8,000 lines in 40 files on master at b0d2729.
  • Tests stay JavaScript. Only production files convert.
  • Done bar per leaf: file renamed to .ts/.tsx, shape kept, explicit types added, the file's typecheck baseline lines gone. strict stays false.
  • Types only. A bug that typing exposes becomes its own ticket, not a fix inside a leaf.
  • Written against master, which holds the page store on MobX 7 annotation maps.
  • Vocabulary: GLOSSARY.md (Page, Page store, Renderer bridge, Shell). Conventions: docs/agents/issue-tracker.md (TypeScript leaves, Checks) and CODING_STANDARDS.md (TypeScript renames).
  • Research findings land on throwaway research/<name> branches, pushed, never merged.

Decisions so far

  • Inventory the in-scope files for the page TypeScript conversion: 40 files, 14 of them JSX, no import cycles; leaf-first order ends in the chain Alignment, Run, RunList, store index, App, page entry. --noImplicitAny adds 414 diagnostics in scope, 267 of them in seven files. lodash and d3-array have no types. Renames break src/pageNodeImports.test.js, scripts/page-store-coverage.js and every baseline line.
  • What do MobX 7 annotation maps need from TypeScript?: nothing extra for the store as it stands. Map keys are checked against public members only, annotation kinds and override are runtime-only, and the store has no flow and no non-public members. The Jest field trap it reported does not reproduce; see the Option prototype.
  • How does the page see the renderer bridge's type?: one declared interface in src/common/rendererBridge.ts plus a Window declaration, no cast. Crossing payloads are typed once in main and imported type-only. The interface lands with the preload as the first leaf and grows leaf by leaf.
  • Prototype the typing pattern on Option and two subclasses: Option<Value, Owner>, the owner typed by one small module-local interface per leaf file, description and hoverInfo optional. The option base is its own early leaf and alone clears 22 of the 26 baseline diagnostics. A subclass never redeclares a base field.
  • Do PropTypes go when a panel gets typed props?: yes, in the same leaf. React 19 already ignores them, so it is dead-code removal. Store-object props get a small module-local interface; required and optional carry over exactly; the last leaf drops the direct prop-types dependency.
  • How is "no implicit any" checked with strict off?: by a second tsc --noImplicitAny pass inside yarn typecheck:baseline that requires zero diagnostics in any .ts or .tsx file, with no allowlist. Lint bans a written any and applies the "full typing" rules to all TypeScript. It is its own leaf, landing first.
  • Choose the slices and their order: 17 leaves of whole files grouped by family; Run is one leaf. Fixed order is the check, then the bridge, the option base before its subclasses, the app shell after all other conversions, close-out last; the rest is free. @types/lodash and @types/d3-array come in with their first importer, and the baseline script learns to pass when empty.
  • What happens to the bugs typing exposes?: a leaf keeps the behaviour, accommodates with a widened type or a reasoned @ts-expect-error, files one issue per bug outside the spec, and carries on. Two are known and get filed with the spec: the delete icon's title prop and MultistateNumber.error.

Not yet specified

  • The spec text itself: user stories, testing decisions, and the 17 leaf tickets. Not a decision; it is the hand-off once the last ticket closes.

Out of scope

  • Turning on strict or noImplicitAny in tsconfig.json, and removing allowJs.
  • Converting .test.js files and the jest/ setup files to TypeScript.

Sub-issues

Sub-issues

8 of 8 Issues completed
Loading 8 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    wayfinder:map

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions