Docs
ts-capture turns the values your code is called with into TypeScript types in your source. It's a process, not just a library — these docs are organized so you can find what you need by intent.
Start here #
About to run it? ts-capture writes to your source files — commit your work first: Review & apply safely.
New to ts-capture? Read How it works for the mental model, then do the Getting started tutorial.
Already know what it does? Jump to a how-to: Use with Vite/Vitest · Review & apply safely.
Looking up a flag or command? See the Configuration reference.
Calling a service with no contract? Record what it answers and get its types: Type a service with no contract.
Want to see what it writes first? In real code: before and after on real code, the weak results included.
The four kinds of docs #
This documentation follows the Diátaxis model — each page is one of four kinds, so it's clear whether you're learning, doing, or looking something up.
Tutorials — learning by doing #
- Getting started — a guided first run, from
install to a successful
apply.
How-to guides — task-focused #
- Use with Vite / Vitest
- Use with Svelte 5
- Use with Jest (Babel)
- Use without a bundler
- Review & apply safely
- Check the types you wrote
- Type a value or JSON
- Type a service with no contract
- Pair with TypeStat
Reference — facts #
- CLI — every command and flag.
- Configuration — every
infer./* apply.flag, its default, and the config-file / CLI form.* - API —
typesFromValues,annotate,annotateProjectandinstrumentSource, for a runner or build step of your own. - Packages — the package matrix and how they fit.
Explanation — understanding #
- How it works — observe → merge → apply.
- Why runtime observation — the strategy, and when it helps vs hurts.
- What it does to your project — the source it rewrites, the getters it runs, the data it writes.
- What it cannot infer — the limits and failure modes.
- JSX element typing — how React elements are typed, and the boundary for other JSX frameworks.