village-builder

VB-382: The state’s shapes as types, and tsc in npm test

Status: blocked Waits for: VB-380 Priority: 3 Size: M Arch: yardstick Phase: implement Design ref: none (code structure). docs/typescript-plan.md (P10); the survey in backlog/VB-055.md. Goal: src/types.ts holds the shapes of the state: State, World (w), Pawn, Household, Farmstead, Village, Job, Agent, Plot, Store and the like, written from the 117 @state lines (24 files; 33 in sim/scenarios, 21 in gen.js) and from the plain-data invariants in tests/lib/invariants.js. st is plain data as a type: Plain<T> (no function, no class instance, no Map or Set where tests/plaindata.js forbids them; typed arrays where the world has them). The @state lines go, or each becomes one line pointing to its type (// @state: see State.tick), and tests/lint.js’s rule “every top-level key of w and st has an @state tag” is replaced by a type check: a list of keys as const satisfies readonly (keyof State)[] and a type that fails when a key is missing (to verify that this is expressible), compared in a test with the keys of a seeded state. tsc --noEmit runs in npm test. Modules are annotated only at the signatures of exported functions that take st, hh, pawn, farm, village and job (st: State), not yet inside. Acceptance criteria: