fix(seo-graph-core): accept Reference array for buildArticle isPartOf#54
Open
schlessera wants to merge 1 commit into
Open
fix(seo-graph-core): accept Reference array for buildArticle isPartOf#54schlessera wants to merge 1 commit into
schlessera wants to merge 1 commit into
Conversation
ArticleInput.isPartOf was typed as a single `Reference`, but the shipped
AGENTS.md "Personal blog" recipe links a posting to both its WebPage and
the Blog via `isPartOf: [{ '@id': webPage }, { '@id': blog }]`. The
builder already passes the value through verbatim (`isPartOf:
input.isPartOf`), so the array worked at runtime — but the type rejected
it, forcing an `as` cast.
Widen the input type to `Reference | Reference[]`. Pure type change; no
runtime difference. Add a test asserting the array is emitted verbatim.
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ArticleInput.isPartOfis typed as a singleReference:But the shipped "Personal blog" recipe in
AGENTS.mdlinks a posting to both itsWebPageand theBlog:(AGENTS.md L681 and L827 — the only array
isPartOfrecipes in the guide, bothbuildArticle.)The builder already emits the value verbatim —
isPartOf: input.isPartOf(article.ts L74) — so the array is correct at runtime. Only the type rejects it, so following the documented recipe requires anascast under strict TS.Fix
Widen the input type to
Reference | Reference[]. Pure type change — no runtime difference; single-reference callers are unaffected.src/pieces/article.ts— widenisPartOftype + expand the JSDoc with the array example.test/pieces.test.ts— add a case asserting an array is emitted verbatim.minor(widens a public input type, non-breaking).Verification
pnpm build && pnpm typecheck && pnpm test && pnpm format:checkall green locally (core 59 tests, +1 new).Open question — scope
isPartOf: Referencealso appears onbuildWebPage,buildVideoObject, andbuildSiteNavigationElement. schema.org allows arrays there too, but no in-repo recipe passes one, so I kept this PR scoped tobuildArticle(the documented, demonstrated case). Happy to widen the others in this PR if you'd prefer consistency across all builders — just say the word.