Skip to content

Commit

Permalink
minor: slightly rejigged some ts type check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alasdairwilson committed Jan 14, 2025
1 parent 9854bf1 commit 5de36f0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ const TableOfContents: React.FC<TableOfContentsProps> = ({ markdown, tocTitle }:
children &&
typeof children === "object" &&
"$$typeof" in children &&
children?.$$typeof === Symbol.for("react.transitional.element")
children?.$$typeof === Symbol.for("react.transitional.element") &&
"props" in children
) {
if (typeof children === "object" && children !== null && "props" in children) {
children = (children as any).props.children ?? undefined
}
children = (children as any).props.children ?? undefined
}
children = String(children).replaceAll("$", "")
useEffect(() => {
Expand Down

0 comments on commit 5de36f0

Please sign in to comment.