#1267·shiki

@shikijs/vitepress-twoslash renders some special code blocks incorrectly.

Author: ajihoCreated Mar 21, 2026Updated Mar 21, 2026

Validations

Describe the bug

Can work normally:

typescript
console.log('hello')
//      ^?

Cannot read properties of undefined (reading 'children')

typescript
// @errors: 1005
let a = (4
Image

This requirement should be reasonable, as the code comes from the official documentation of TypeScript: https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html#syntax

The expected result should be as shown in the figure below:

Image

Reproduction

https://stackblitz.com/edit/vite-sycfvqmv?file=docs%2Fexample.md

Clicking the Get Started button will result in an error.

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests