Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 25, 2023
1 parent b3985e2 commit 8763a11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ export default function remarkValidateLinks(options, fileSet) {
visit(tree, function (node) {
const data = node.data || {}
const props = data.hProperties || {}
let id = String(props.name || props.id || data.id || '')
// @ts-expect-error: accept a `data.id`, which is not standard mdast, but
// is here for historical reasons.
const dataId = /** @type {unknown} */ (data.id)
let id = String(props.name || props.id || dataId || '')

if (!id && node.type === 'heading') {
id = slugger.slug(
Expand Down

0 comments on commit 8763a11

Please sign in to comment.