diff --git a/build-scripts/generate-epubs.ts b/build-scripts/generate-epubs.ts index a17547ab..4e3f83f6 100644 --- a/build-scripts/generate-epubs.ts +++ b/build-scripts/generate-epubs.ts @@ -83,7 +83,8 @@ function rehypeMakeFixTwoSlashXHTML() { }; } -const remarkTwoslash = (remarkTwoslashDefault as never as {default: typeof remarkTwoslashDefault}).default ? (remarkTwoslashDefault as never as {default: typeof remarkTwoslashDefault}).default : remarkTwoslashDefault; +// https://github.com/shikijs/twoslash/issues/147 +const remarkTwoslash = (remarkTwoslashDefault as never as {default: typeof remarkTwoslashDefault}).default ?? remarkTwoslashDefault; async function generateEpubHTML(slug: string, content: string) { const unifiedChain = unified() diff --git a/build-scripts/social-previews/shared-post-preview-png.ts b/build-scripts/social-previews/shared-post-preview-png.ts index f88ca14e..d2a9bdf8 100644 --- a/build-scripts/social-previews/shared-post-preview-png.ts +++ b/build-scripts/social-previews/shared-post-preview-png.ts @@ -14,15 +14,11 @@ import { findAllAfter } from "unist-util-find-all-after"; import rehypeStringify from "rehype-stringify"; import { fileURLToPath } from "url"; +// https://github.com/shikijs/twoslash/issues/147 const remarkTwoslash = ( remarkTwoslashDefault as never as { default: typeof remarkTwoslashDefault } ).default - ? ( - remarkTwoslashDefault as never as { - default: typeof remarkTwoslashDefault; - } - ).default - : remarkTwoslashDefault; + ?? remarkTwoslashDefault; const __dirname = dirname(fileURLToPath(import.meta.url));