Apply suggestions from code review

Co-authored-by: James Fenn <me@jfenn.me>
This commit is contained in:
Corbin Crutchley
2023-02-11 15:09:40 -08:00
committed by GitHub
parent 0eac5484bb
commit 55ebf9a9a2
2 changed files with 4 additions and 7 deletions

View File

@@ -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) { async function generateEpubHTML(slug: string, content: string) {
const unifiedChain = unified() const unifiedChain = unified()

View File

@@ -14,15 +14,11 @@ import { findAllAfter } from "unist-util-find-all-after";
import rehypeStringify from "rehype-stringify"; import rehypeStringify from "rehype-stringify";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
// https://github.com/shikijs/twoslash/issues/147
const remarkTwoslash = ( const remarkTwoslash = (
remarkTwoslashDefault as never as { default: typeof remarkTwoslashDefault } remarkTwoslashDefault as never as { default: typeof remarkTwoslashDefault }
).default ).default
? ( ?? remarkTwoslashDefault;
remarkTwoslashDefault as never as {
default: typeof remarkTwoslashDefault;
}
).default
: remarkTwoslashDefault;
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));