Worked example · Migration
Migrating a codebase to TypeScript strict mode with WDD
A strict-mode migration is a long, mechanical grind with a perfect counter: the number of type errors. WDD fits it well, provided the rules forbid the shortcuts (any, ts-ignore, non-null assertions) that make the counter lie.
The goal
Turn on "strict": true in a 60,000-line TypeScript codebase with zero type errors and no new any, @ts-ignore or ! assertions.
The verifier
tsc --noEmit, plus a script that counts new any, @ts-ignore and non-null assertions against the main branch and fails if there are any.
Why this check: The error count shows progress; the shortcut counter stops the agent from "fixing" errors by switching the checker off locally.
The set-up
- Strict mode turned on, so the starting count is visible (it was 2,300).
- The shortcut counter as part of the verifier.
- Work split by folder in TODO.md, so each round has a small, finishable target.
The kickoff prompt
Kickoff
Strict mode is on. Make tsc --noEmit report zero errors, folder by folder, in the order of TODO.md. Never add any, @ts-ignore, @ts-expect-error or non-null assertions; the verifier counts them. Fix the types properly. Commit after each folder. Keep going until zero.
How the rounds went
- Days 1 and 2
- Utility folders first. The count drops from 2,300 to 1,400; the agent builds up a set of typed helpers it reuses later.
- Day 3
- In the data layer the agent starts adding "as unknown as" casts. The shortcut counter does not catch that pattern; the human adds it to the counter and the push says so. The agent reworks those files.
- Day 5
- Zero errors, zero new shortcuts, tests green.
What worked
- A falling number per round, visible in the commit messages.
- Extending the shortcut counter the moment a new kind of cheating appeared.
- Running the test suite as well, because types can be "fixed" in ways that change behaviour.
What to watch for
- Every check can be gamed by a persistent agent. Watch the diffs for new patterns and add them to the verifier.
- Long runs fill the context window: keep NOTES.md current so a fresh session can pick up.
Build a kit for a task like this
A worked example written to show the method, not a report of a specific project.
Questions people ask
How long does a WDD migration take?
It depends on the size and the model; the example ran over several days of unattended rounds. The point is that the person reviews folders, not individual errors.
Why not let the agent use any where it is hard?
Because then the error count stops meaning anything. If a few places truly need an escape hatch, list them in AGENTS.md by name.