village-builder

VB-055: TypeScript: real modules, typed state, a formatter and measures of width: survey and tasks

Status: done (2026-11-12) Priority: 3 Size: S Arch: yardstick Phase: implement Design ref: none (test infrastructure) Goal: A misspelt field (hh.grian), an argument in the wrong place or a holder of the wrong kind is silent in plain JavaScript until it misbehaves. Kim decided on 10 November (code review) to move the code to TypeScript, by a plan: real modules first, then .ts and types for the state, then strictness; and with the same sweep a standard formatter, and measures of a module’s width in place of the cap on its length. Survey what the move touches and write the implement tasks. This replaces the first version of this task (checkJs with JSDoc and a hand-written types.d.ts), which sees little: every module is reached through VB['<key>'], which has no type, so no call between modules is checked. Acceptance criteria:

Survey (12 November 2026, checkout at 1e9b93b; every count has its command)

The tasks it produced are in docs/typescript-plan.md (P1 to P14). The questions are in QUESTIONS.md, “VB-055: the move to TypeScript”. Nothing under src/, tests/ or the build changed; no dependency was installed in the repository (scratch installs of TypeScript 5.6.3, esbuild 0.25.0 and Prettier 3.3.3 were made outside it).

Tried here, on Node v22.23.4 (node --version; .github/workflows/checks.yml uses node-version: 22 in both jobs, so the latest 22.x), in a scratch directory:

The modules and what each import and export becomes

The late lookups

Tests and tools that replace a module’s function

The page script

Tools that parse the source

Types, the @state tags

Measures of width, recounted

When, and the cost

Notes added with the survey