Uh oh!
There was an error while loading. Please reload this page.
docs(layout): annotate the sidebar-nav grouped-navigation example as NavGroup[] - #6139
Merged
Merged
Conversation
…NavGroup[] (#6131) The "Complete Example" block left `navigationItems` unannotated, so its `badgeVariant: 'destructive'` widened to `string` and the array no longer assigned to `SidebarNav`'s `items: NavItem[] | NavGroup[]`. TypeScript reported the union's other branch, so the message read as a wrong data shape; the shape was right. Annotate the array as `NavGroup[]` and import the type in the same block, since every doc block compiles in isolation and an annotation that does not resolve silently switches off the check it was added to perform. The fence stays `plaintext` — re-fencing `content/docs/layout` belongs to #5867. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019b5UBNMtTzKbVtZZGvFuxe
yinlianghui-tw
marked this pull request as ready for review
August 24, 2026 20:40
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 24, 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 freeto 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.
Fixes#6131
Two files:
content/docs/layout/sidebar-nav.mdx(two lines) and a changeset.The defect
The "Complete Example" block left
navigationItemsunannotated, so itsbadgeVariant: 'destructive'widened tostring.SidebarNavdeclaresbadgeVariant?: 'default' | 'destructive' | 'outline', so the array stopped assigning toitems: NavItem[] | NavGroup[]. TypeScript then reports the union's other branch, whichis why the message reads "missing the following properties from type 'NavItem': title,
href" and looks at first like a wrong data shape. The data shape was always right — the
annotation was missing.
The fix
The type is imported in the same block, because every block compiles in isolation. An
annotation naming a type the block cannot see errors on the annotation itself, at which
point TypeScript stops checking the literal underneath and the TS2322 disappears — the
false-green shape already recorded for
guide/theminginscripts/check-doc-snippet-types.mjs. The import here resolves; the measurements beloware what prove it.
Measurement, re-derived on current
origin/main(based5b80c678, verified at1803226b7)The issue's numbers were taken before PR #6129 merged; the population has since grown from
211 to 224, so every number below is re-derived rather than inherited.
The block is still
plaintext-fenced on main, so it is not in the compile population —--build-filterdoes not even list@object-ui/layout. Re-fencingcontent/docs/layoutis #5867's lane, so the fence is left alone here and every measurement uses a throwaway
re-fence of that one fence under an
EXITtrap.plaintext)Reproduced diagnostic, before the fix:
Non-vacuity. The annotation is load-bearing, not decorative: removing it again (still
re-fenced) returns the identical
TS2322at the identical site235:7, andSemantic phase: 224 of 224 block(s) judged, 1 failed. Restoring it returns exit 0. Bothmutation legs were confirmed on disk by grepping for the specific text inserted and removed
before reading any result, and both restore legs ran from an
EXITtrap against thecommitted fix —
git checkout HEAD --followed by the path, never the bare form thatomits
HEAD.Declared fragment count is unmoved at 111, no
FRAGMENT_MARKERis added, andUNGATED_DOCS, the ledger and the gate itself are untouched.Gates run, each quoting its own verdict line (all at
1803226b7, tree clean)check:doc-snippetsexit 0 —Semantic phase: 223 of 223 block(s) judged, 0 failed./Every covered documentation snippet compiles against the built types.check:doc-typesexit 0 —Every documented component type is registered.check:control-bytesexit 0 —check-control-bytes: OK (scanned 5083 tracked text file(s); skipped 85 binary).docs:check-linksexit 0 —Links are valid across 15 scan roots.packages/layout/src/__tests__plusscripts/__tests__/check-doc-snippet-types.test.ts—Test Files 20 passed (20),Tests 232 passed (232).@object-ui/site) exit 0, and the renderedapps/site/.next/server/app/docs/layout/sidebar-nav.htmlcontains both the annotatednavigationItems: NavGroup[]and thetype NavGroupimport, so the page still renders.Lint, narrowing declared rather than skipped. The linted population was read from
eslint's own configuration, not guessed:
eslint --no-inline-config --format jsonover thetwo changed files reports 2 files, 0 errors, both with
File ignored because no matching configuration was supplied—content/docs/**and.changeset/**are outside the lint population entirely. No TypeScript or JavaScript sourcefile changed, so no untouched file's lint verdict can move either.
One note on the environment, not on this diff: the site build fails with
Module not found: Can't resolve '@object-ui/plugin-gantt'until the workspace packages arebuilt, because the root
buildscript excludes the site. Afterturbo run build --filter='!@object-ui/site'it is green.Scope
The type defect only. The fence stays
plaintextand no othercontent/docs/layoutpage is touched — #5867 remains open and its layout batch is not addressed here. With this
landed, the layout group has no remaining type defect of its own, so that batch should be a
pure re-fence.
Not marked ready and auto-merge is not enabled; the PM verifies CI and lands it.
Generated by Claude Code