explaingit

joshuakgoldberg/expressive-code-twoslash

Analysis updated 2026-07-08 · repo last pushed 2026-07-03

Audience · developerComplexity · 2/5ActiveSetup · moderate

TLDR

A plugin that adds Twoslash-style TypeScript type annotations, error messages, and callouts to code blocks rendered with Expressive Code on documentation websites and blogs.

Mindmap

mindmap
  root((repo))
    What it does
      Shows type hover info
      Displays compiler errors
      Highlights lines and callouts
    Tech stack
      TypeScript
      Expressive Code
      Twoslash
    Use cases
      Documentation sites
      Developer blogs
      Library docs
    Audience
      Doc site builders
      Blog authors
      Library maintainers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add interactive type hover boxes and compiler error messages to TypeScript code samples in your blog.

USE CASE 2

Build polished library documentation with inline Twoslash annotations like the official TypeScript docs.

USE CASE 3

Show type extraction, code completions, and emitted files alongside code blocks in tutorials.

What is it built with?

TypeScriptExpressive CodeTwoslash

How does it compare?

joshuakgoldberg/expressive-code-twoslash0xhassaan/nn-from-scratch0xzgbot/hermes-comfyui-skills
Stars00
LanguagePython
Last pushed2026-07-03
MaintenanceActive
Setup difficultymoderatemoderateeasy
Complexity2/54/51/5
Audiencedeveloperdeveloperdesigner

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires an existing Expressive Code setup in a web project and familiarity with Twoslash annotation syntax.

No license information was provided in the explanation.

In plain English

If you write documentation or a blog that includes TypeScript code samples, you probably want readers to understand not just the code itself but the types and errors behind it. This plugin brings Twoslash support to Expressive Code, which is a tool for rendering attractive code blocks on websites. Twoslash is a format for annotating TypeScript code with inline information like type hovers, error messages, and callouts. With this plugin, your code blocks can display that rich type information the same way the official TypeScript documentation does. The plugin works by hooking into Expressive Code, extending it so that TypeScript code blocks can include Twoslash-style annotations. When a code block is rendered on your site, the plugin processes those annotations and displays them visually. It supports TypeScript, React TSX, and Vue code blocks. The features cover a range of useful documentation capabilities. You can show JSDoc comments and type information in hover boxes, display compiler error messages, highlight specific lines, and add callout notes alongside your code. It also supports type extraction, code completions, and the ability to show what files the TypeScript compiler emits. These are the kinds of details that make technical tutorials significantly clearer, especially when you are explaining why a particular piece of code behaves a certain way. This tool is designed for people building documentation sites, developer blogs, or any web project that already uses Expressive Code and wants richer TypeScript examples. If you maintain a library and want your docs to feel as polished as the TypeScript language's own documentation, this plugin helps bridge that gap without requiring readers to open an editor themselves.

Copy-paste prompts

Prompt 1
How do I install and configure expressive-code-twoslash in my Expressive Code setup to show type hovers and compiler errors in my TypeScript code blocks?
Prompt 2
Write a Twoslash-annotated TypeScript code sample that demonstrates showing a type error message and a callout note using expressive-code-twoslash syntax.
Prompt 3
Show me how to render React TSX code blocks with Twoslash type information and JSDoc hover comments using this plugin in an Astro or Next.js docs site.
Prompt 4
How can I highlight specific lines and display type extraction results in my documentation code blocks using expressive-code-twoslash?

Frequently asked questions

What is expressive-code-twoslash?

A plugin that adds Twoslash-style TypeScript type annotations, error messages, and callouts to code blocks rendered with Expressive Code on documentation websites and blogs.

Is expressive-code-twoslash actively maintained?

Active — commit in last 30 days (last push 2026-07-03).

What license does expressive-code-twoslash use?

No license information was provided in the explanation.

How hard is expressive-code-twoslash to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is expressive-code-twoslash for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.