mattpocock/twoslash-1 — explained in plain English
Analysis updated 2026-07-13 · repo last pushed 2024-06-09
Add accurate type annotations and error messages to code samples in your library's documentation.
Write blog posts with TypeScript examples that show hover tooltips as static text.
Create tutorials where readers see the same helpful context their editor would display.
| mattpocock/twoslash-1 | 0-bingwu-0/live-interpreter | 0xkaz/llm-governance-dashboard | |
|---|---|---|---|
| Stars | 2 | 2 | 2 |
| Language | — | Python | Python |
| Last pushed | 2024-06-09 | — | — |
| Maintenance | Dormant | — | — |
| Setup difficulty | moderate | moderate | hard |
| Complexity | 2/5 | 2/5 | 4/5 |
| Audience | developer | general | ops devops |
Figures from each repo's GitHub metadata at analysis time.
Requires a TypeScript project setup and integration with a documentation renderer or Markdown pipeline.
Twoslash is a tool that helps you write better TypeScript documentation. When you're showing code examples in a tutorial, blog post, or docs site, you often want to display extra information like type annotations, error messages, or hover hints, the kind of helpful context your code editor shows you. This project provides a markup format that lets TypeScript itself generate that information ahead of time, so your readers get richer, more informative code samples without you having to manually type out every detail. At a high level, you write TypeScript code with some special markup mixed in. Twoslash then runs that code through the TypeScript compiler and extracts the type information, errors, and other metadata automatically. The result is a self-contained code sample where all the useful context is baked in, think of it like having your editor's hover tooltips and inline errors captured and displayed as static text that anyone can read in a browser. The main audience is people writing TypeScript documentation or tutorials. If you maintain a library and want your docs to show exactly what types a function returns, or what error a user would see if they pass the wrong argument, this saves you from manually writing and maintaining all of that information by hand. Instead of typing out a comment saying "this returns a Promise<string>," the tool pulls that detail directly from the compiler, so your examples stay accurate even as your code changes. This is the successor to an earlier tool called @typescript/twoslash that was part of the TypeScript website. The README is sparse on implementation details, but it points to separate documentation for a deeper dive and a migration guide if you're coming from the older version. The project is maintained by Orta Therox, Anthony Fu, and Microsoft under an MIT license.
Twoslash is a tool that automatically adds type annotations, error messages, and hover hints to your TypeScript code examples for documentation. It uses the TypeScript compiler to pull this information so your docs stay accurate as your code changes.
Dormant — no commits in 2+ years (last push 2024-06-09).
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.