summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/src/rehype-optimize-static.ts
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-06-21 21:09:49 +0800
committerGravatar GitHub <noreply@github.com> 2023-06-21 21:09:49 +0800
commitf275d058fcfe564b19bf3536c1a208e6f9cb2159 (patch)
tree2b239737ee68f2a46c493b595f3155ea6421c2db /packages/integrations/mdx/src/rehype-optimize-static.ts
parent01b1c21c6bf1a0f8f8a753fc31777186e5cb09c0 (diff)
downloadastro-f275d058fcfe564b19bf3536c1a208e6f9cb2159.tar.gz
astro-f275d058fcfe564b19bf3536c1a208e6f9cb2159.tar.zst
astro-f275d058fcfe564b19bf3536c1a208e6f9cb2159.zip
Update safe dependencies (#7430)
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