Status: blocked
Waits for: VB-382
Priority: 3
Size: M
Arch: yardstick
Phase: implement
Design ref: none (code structure). docs/typescript-plan.md (P11); the survey in backlog/VB-055.md.
Goal: What the code review said types would have caught: type(holder) in sim/stores taking any object for a pawn, and the positional parameters of heirRanking (seven) and post (three optional). Give sim/stores a Holder as a union of three (pawn, household, village; VB-237 states the three) with a kind the functions narrow on; give issue(st, command) a Command that is a union over the verbs of src/sim/commands.ts (actor, verb, target, args, source), so a verb’s args are checked at every issue call; type heirRanking’s parameters and post’s optionals as they are (changing them to an options object is a refactor of its own and out of scope; the task may add it to the backlog).
Acceptance criteria:
Holder in src/types.ts; every call of a sim/stores operation passes a typed holder; the calls that did not are listed in the task file with what each was (a bug found, a test, a narrowing).Command and the verb table typed; the 17 later(...) calls of sim/commands are gone already (VB-378), so the verbs call their handlers by import, and tests/commands.js (“only the verbs call the acts they wrap”) reads the import graph or the type.tests/types-negative.ts holds a wrong args and a household passed as a pawn, each failing.node tools/same.js --base REF prints same); if a bug is found it is a separate task (the finding is in the task file), not fixed here unless the fix leaves behaviour unchanged.docs/typescript-plan.md, where this task is P11): waits for Kim’s answers to QUESTIONS.md, “VB-055: the move to TypeScript” (the formatter, the bundler, the hook, the width measures, when, the page and the tests, strict), which may change its criteria; the three rules common to these tasks are at the top of the plan.sim/stores, sim/commands or sim/heirs.