Twoslashサポート
Twoslashはコードブロックの中でのインラインタイプホバーを提供します。
基本的な使用法
twoslash
メタデータを追加することで、コードブロックに対してTwoslashを有効にすることができます。
マークダウン
```ts twoslash
// @errors: 2540
interface Todo {
title: string
}
const todo: Readonly<Todo> = {
title: 'Delete inactive users'.toUpperCase()
// ^?
}
todo.title = 'Hello'
Number.parseInt('123', 10)
// ^|
// Just comments, so Popup will be
// not behind the viewport of `<code>`
// element due his `position: absolute` style
//
```
レンダリングされます。
interface Todo {
: string
}
const : <Todo> = {
title: string
title: 'Delete inactive users'.()
}
.title = 'Hello'
.p- parseFloat
- parseInt
- prototype
('123', 10)
カスタムログメッセージ
追加することでコードにログメッセージを追加できます。
@log: <メッセージ>
カスタムログメッセージ@error: <メッセージ>
カスタムエラーメッセージ@warn: <メッセージ>
カスタム警告メッセージ@annotate: <メッセージ>
カスタムアノテートメッセージ
const = 1Custom log messageconst = 1Custom error messageconst = 1Custom warning message Custom annotation message