ts-capture watches your code run under its tests and writes the types it saw back into the source. These are annotations it wrote into real code: the ones you would have written yourself, and the ones a reviewer should change. What it left alone, and why, is on How it decides.
Nothing here was typed by hand. Each example is cut from the diff of an actual run; the highlighted parts are what apply added.
The tests hand the service a function that returns a Date. ts-capture saw it called and saw what came back. gateway stays as it was: what was observed of it carried nothing worth writing.
The return type lists the two SKUs the tests used. The function accepts any SKU: it indexes by a variable. Nothing flags this, because the type describes the test run exactly.
The collection holds whatever metadata a caller attached. both and only2 are keys from nest's own tests, now written into the source as if they were the type.
A reviewer would writeleave it unannotated, or type the collection where it is built
The parameter was typed already. What the callback returned matched RouteData, a type the file already uses, so that name is written and not the shape.
Hono's escaped strings are String objects, and that is what was observed. The annotation is accurate about the value and is not the type the code means.
A reviewer would writeHtmlEscapedString
No example matches both filters.
Where these come from
mini-app at d99f8ca, ts-capture 344f0ff, 5 examples. 292 lines of untyped TypeScript with 17 tests, written to measure ts-capture against types a person wrote first.
nestjs/nest at 09dba60ce, ts-capture 344f0ff, 3 examples. The NestJS framework, at a pinned commit, observed through its own test suite.
honojs/hono at 017000d6, ts-capture 344f0ff, 2 examples. The Hono web framework, at a pinned commit, observed through its own test suite. Already strictly typed: there is little left to add.
A type is only as good as what the tests passed in. The examples marked “needs review” are not bugs: they describe the test run exactly, which is why nothing flags them. See what it cannot infer and review and apply safely.