Skip to content

Commit 22b9d30

Browse files
chrispadercodex
andcommitted
test(docs): validate all canonical alias exports
Co-authored-by: Codex <noreply@openai.com>
1 parent 73023ec commit 22b9d30

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

‎docs/scripts/check-api.mjs‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,21 @@ for (const name of deprecatedExports) {
258258
const target = corePackage.children.find((child) => child.id === alias.target)
259259
assert.ok(target, `Missing reference target: ${name}`)
260260
// A canonical type and value can have separate reflection IDs with the same name.
261+
const canonicalExports = corePackage.children.filter(
262+
(child) => child.name === target.name,
263+
)
261264
assert.ok(
262265
deprecated.content.some((part) =>
263-
corePackage.children.some(
264-
(child) => child.id === part.target && child.name === target.name,
265-
),
266+
canonicalExports.some((child) => child.id === part.target),
266267
),
267268
`Missing canonical replacement link: ${name}`,
268269
)
269-
assert.ok(
270-
!target.comment?.blockTags?.some((tag) => tag.tag === '@deprecated'),
271-
`Canonical export is deprecated: ${target.name}`,
272-
)
270+
for (const canonical of canonicalExports) {
271+
assert.ok(
272+
!canonical.comment?.blockTags?.some((tag) => tag.tag === '@deprecated'),
273+
`Canonical export is deprecated: ${canonical.name}`,
274+
)
275+
}
273276
const section = corePackageHome
274277
.split(`### ~~${name}~~\n`)[1]
275278
?.split(/\n(?:#{1,3} |\*\*\*)/)[0]

0 commit comments

Comments
 (0)