Skip to Content
Twoslash

Twoslash

Ordinary TypeScript blocks receive syntax highlighting. Adding the twoslash metadata also runs TypeScript analysis during the documentation build and embeds its results in the generated HTML.

Type query

interface Completion { : string; : boolean; } const : Completion = { : "ok", : true };
const completion: Completion
completion
;

Expected diagnostic

const answer: number = "forty-two";
Type 'string' is not assignable to type 'number'.

Ordinary code block

This block is highlighted but is not passed through Twoslash:

const greeting: string = "hello";
Last updated on