summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/src/rehype-optimize-static.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/mdx/src/rehype-optimize-static.ts')
-rw-r--r--packages/integrations/mdx/src/rehype-optimize-static.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/packages/integrations/mdx/src/rehype-optimize-static.ts b/packages/integrations/mdx/src/rehype-optimize-static.ts
index c476f7c83..573af317e 100644
--- a/packages/integrations/mdx/src/rehype-optimize-static.ts
+++ b/packages/integrations/mdx/src/rehype-optimize-static.ts
@@ -64,6 +64,7 @@ export function rehypeOptimizeStatic(options?: OptimizeOptions) {
}
// For possible subtree root nodes, record them in `elementStack` and
// `allPossibleElements` to be used in the "leave" hook below.
+ // @ts-expect-error MDX types for `.type` is not enhanced because MDX isn't used directly
if (node.type === 'element' || node.type === 'mdxJsxFlowElement') {
elementStack.push(node);
allPossibleElements.add(node);
@@ -72,6 +73,7 @@ export function rehypeOptimizeStatic(options?: OptimizeOptions) {
leave(node, _, __, parents) {
// Do the reverse of the if condition above, popping the `elementStack`,
// and consolidating `allPossibleElements` as a subtree root.
+ // @ts-expect-error MDX types for `.type` is not enhanced because MDX isn't used directly
if (node.type === 'element' || node.type === 'mdxJsxFlowElement') {
elementStack.pop();
// Many possible elements could be part of a subtree, in order to find