fix(tests): narrow markdown-it attributes to strings in doc link checks (#14217)

Token.attrGet returns string | number | null, so the link checks added in
#14207 failed typecheck on main. Keep only string href values before
matching them.
This commit is contained in:
morluto authored and GitHub committed 2026-11-23 19:15:02 -05:00
1 parent df6454c3fd
commit e39b56fc5d
2 files changed
+5 -4

No files matched your search

@@ -110,9 +110,10 @@ it("links to the workflow asset outside the documentation site's base", async ()
const workflowLinks = new MarkdownIt()
.parse(guide, {})
.flatMap((token) => token.children ?? [])
.flatMap((token) =>
token.type === "link_open" ? [token.attrGet("href") ?? ""] : [],
)
.flatMap((token) => {
const href = token.type === "link_open" ? token.attrGet("href") : null;
return typeof href === "string" ? [href] : [];
})
.filter((href) =>
href.endsWith("examples/github-actions/rea-analysis.yml"),
);