Twoslash
Use Typescript Twoslash in your docs
Usage
Thanks to the Twoslash integration of Shiki, the default code syntax highlighter, it is as simple as adding a transformer.
Update your serverExternalPackages
in Next.js config:
Add to your Shiki transformers.
Add styles, Tailwind CSS v4 is required.
Add MDX components.
Now you can add twoslash
meta string to codeblocks.
Example
Learn more about Twoslash notations.
Cache
You can enable filesystem cache with typesCache
option:
How is this guide?