Skip to content

Installing

Twoslash Features

FeatureSupported Status
JSDocs and Type Hover boxes
Error Handling/Messages
Type Extraction
Code Completions
Code Highlighting
Code Cutting
Callouts
TSComiler Overrides
Show Emitted Files⛔️

Installation

Install the package with your favorite package manager

Terminal window
npm i expressive-code-twoslash

Add to EC Config

Add ecTwoSlash to your Expressive Code plugin list

import { defineConfig } from "astro/config";
import astroExpressiveCode from 'astro-expressive-code'
import ecTwoSlash from "expressive-code-twoslash";
// https://astro.build/config
export default defineConfig({
integrations: [
astroExpressiveCode({
plugins: [ecTwoSlash()],
}),
],
});

Config Options

Default config options shown.

ecTwoSlash({
explicitTrigger: true,
includeJsDoc: true,
allowNonStandardJsDocTags: false,
languages: ["ts", "tsx"],
twoslashOptions: {},
})