diff --git a/packages/twoslash-cli/index.js b/packages/twoslash-cli/index.js index 0cd3515..caee285 100644 --- a/packages/twoslash-cli/index.js +++ b/packages/twoslash-cli/index.js @@ -15,6 +15,7 @@ import { join, dirname } from "path" import remarkShikiTwoslash from "remark-shiki-twoslash" import { basename, extname, sep } from "path" import { tmpdir } from "os" +import ts from "typescript" export const canConvert = (path) => { const usable = [".md", ".ts", ".js", ".tsx", ".jsx"] @@ -90,6 +91,14 @@ async function renderMarkdown(args) { const settings = getSettingsFromMarkdown(fileContent, from) || {} const markdownAST = remark().parse(fileContent) + if (settings.defaultCompilerOptions) { + const {options} = ts.convertCompilerOptionsFromJson(settings.defaultCompilerOptions, ".") + settings.defaultCompilerOptions = { + ...settings.defaultCompilerOptions, + ...options, + } + } + try { // @ts-ignore await remarkShikiTwoslash.default(settings)(markdownAST)