Skip to content

TwoSlash 集成

TwoSlash 是一个强大的工具,用于渲染带有悬停或内联类型信息的 TypeScript 代码块。它对于准备 JavaScript/TypeScript 相关主题的幻灯片非常有用。

要使用它,你可以在代码块的语言标识符中添加 twoslash

md
```ts twoslash
import { ref } from 'vue'

const count = ref(0)
//            ^?
```

它将被渲染为:

ts
import { 
ref
} from 'vue'
const
count
=
ref
(0)

Released under the MIT License.