Skip to content

Commit

Permalink
fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Nov 12, 2024
1 parent 36b22b7 commit 6ac22ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/app/src/features/callout/services/callout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Text } from 'mdast';
import type { Paragraph, Text } from 'mdast';
import type { ContainerDirective } from 'mdast-util-directive';
import type { Plugin } from 'unified';
import { visit } from 'unist-util-visit';
Expand All @@ -13,7 +13,7 @@ export const remarkPlugin: Plugin = () => {
const data = node.data ?? (node.data = {});

// extract directive label
const paragraphs = (node.children ?? []).filter(child => child.type === 'paragraph') ?? [];
const paragraphs = (node.children ?? []).filter((child): child is Paragraph => child.type === 'paragraph');
const paragraphForDirectiveLabel = paragraphs.find(p => p.data?.directiveLabel);
const label = paragraphForDirectiveLabel != null
? (paragraphForDirectiveLabel.children[0] as Text).value
Expand Down

0 comments on commit 6ac22ec

Please sign in to comment.