22 * This file is the core of the @shikijs/twoslash package,
33 * Decoupled from twoslash's implementation and allowing to introduce custom implementation or cache system.
44 */
5- import type { TwoslashExecuteOptions , TwoslashReturn } from 'twoslash'
5+ import type { TwoslashExecuteOptions } from 'twoslash'
66import type { ShikiTransformer } from '@shikijs/core'
77import type { Element , ElementContent , Text } from 'hast'
88
99import { splitTokens } from '@shikijs/core'
10- import type { TransformerTwoslashOptions , TwoslashRenderer } from './types'
10+ import type { TransformerTwoslashOptions , TwoslashRenderer , TwoslashShikiReturn } from './types'
1111import { ShikiTwoslashError } from './error'
1212
1313export * from './types'
@@ -22,7 +22,7 @@ export function defaultTwoslashOptions(): TwoslashExecuteOptions {
2222 }
2323}
2424
25- export type TwoslashFunction = ( code : string , lang ?: string , options ?: TwoslashExecuteOptions ) => TwoslashReturn
25+ export type TwoslashFunction = ( code : string , lang ?: string , options ?: TwoslashExecuteOptions ) => TwoslashShikiReturn
2626
2727export function createTransformerFactory (
2828 defaultTwoslasher : TwoslashFunction ,
@@ -60,7 +60,7 @@ export function createTransformerFactory(
6060 if ( filter ( lang , code , this . options ) ) {
6161 const twoslash = twoslasher ( code , lang , twoslashOptions )
6262 this . meta . twoslash = twoslash
63- this . options . lang = twoslash . meta . extension || lang
63+ this . options . lang = twoslash . meta ? .extension || lang
6464 return twoslash . code
6565 }
6666 } ,
0 commit comments