Uh oh!
There was an error while loading. Please reload this page.
docs(core): fix ComponentRegistry singleton example in README - #5268
Merged
os-support-ai merged 1 commit intoAug 18, 2026
Merged
Conversation
packages/core/README.md's Component Registry snippet taught `new ComponentRegistry()`, but ComponentRegistry is an exported singleton instance, not a class -- packages/core/dist/registry/Registry.d.ts declares `export declare const ComponentRegistry: Registry<any>`. The #5138 doc-snippet type gate measures this as TS2351: This expression is not constructable. README ships to npm inside the package's `files`, so a reader who copied the snippet got a compile error. Drops the `new`, calls ComponentRegistry.register/get directly on the singleton, and adds one line stating it is the process-level shared instance SchemaRenderer resolves every `type` against -- the same wording packages/components/README.md was given in #5160, kept consistent across both READMEs. Updates the UNGATED_DOCS ledger entry for packages/core/README.md in scripts/check-doc-snippet-types.mjs: TS2351x1 is dropped from the reason text now that the diagnostic is gone (measured before/after against the built dist/*.d.ts). The entry is not deleted -- the document's remaining TS2339x2 pair is a separate, pre-existing defect out of scope here, tracked as #5257. Fixes#5258 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-support-ai
marked this pull request as ready for review
August 18, 2026 23:27
Uh oh!
There was an error while loading. Please reload this page.
os-support-ai
deleted the
claude/issue-5258-core-readme-registry-singleton
branch
August 18, 2026 23:28
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#5258
What
packages/core/README.md's Component Registry example taughtnew ComponentRegistry(), butComponentRegistryis an exported singleton instance, not a class. Builtpackages/core/dist/registry/Registry.d.tsdeclares:The #5138 doc-snippet type gate (
scripts/check-doc-snippet-types.mjs) measured this asTS2351: This expression is not constructable. The README ships to npm inside the package'sfiles, so a reader who copied the snippet got a compile error.Verified against the built
packages/core/dist/index.d.tsbefore editing:ComponentRegistryis aconstinstance andRegistryis separately exported as a real class (export declare class Registry< T = any >) — the premise held.Fix
Dropped the
new, callregister/getdirectly on the singleton, and added one line stating it is the process-level shared instance (the part a reader cannot infer from the example) — copied verbatim from the wordingpackages/components/README.mdwas given in #5160, so both READMEs stay consistent:UNGATED_DOCS ledger — please read before reviewing the diff
packages/core/README.mdhas a live entry inscripts/check-doc-snippet-types.mjs'sUNGATED_DOCS. Before this change it read:Measured by temporarily un-gating the file and running the gate against the built types, the diagnostics were exactly:
TS2351at line 49 (this card), fiveTS2304undefined-name diagnostics, andTS2339x2at lines 116/121.This PR fixes only the
TS2351. The ledger entry is intentionally NOT deleted — theTS2339x2pair is a separate, pre-existing defect on the same document and the same ledger line, tracked as out of scope: #5257 (not fixed here, not dispatched at the time this PR was opened). Re-measured after the fix, the entry now reads:Only
TS2351x1is dropped from the reason text. A reviewer should read the survivingTS2339x2clause as expected, not as an incomplete fix on this card — the document is genuinely still ungated because #5257's defects remain, out of scope: #5257.Verification
Built
@object-ui/core's dependency closure plus every package the currently-covered doc snippets import (node scripts/check-doc-snippet-types.mjs --build-filter), then:node scripts/check-doc-snippet-types.mjs— passes (exit 0); "Every covered documentation snippet compiles against the built types."TS2351atpackages/core/README.md:49is gone and only the fiveTS2304+TS2339x2(out of scope, core: cloneAsOverride keeps its input's deep-readonly type, so a Tenant/User override clone does not type-check as mutable #5257) remain.node scripts/check-control-bytes.mjs— passesnode scripts/check-doc-links.mjs— passes ("Links are valid across 13 scan roots.")node scripts/check-changeset-presence.mjs— passesnode scripts/check-changeset-fixed.mjs— passesnode scripts/check-changeset-no-major.mjs— passesnode scripts/check-doc-component-types.mjs— passes (unaffected, run for completeness)Diff is surgically narrow — one README snippet + one ledger reason-text line — so #5257 can land on this same file/ledger entry afterward without conflict.
Changeset:
@object-ui/corepatch (README correction;packages/coreis a released package and its README ships infiles).Hard limits observed
No edits to
docs/adr/**,.claude/**,skills/**,AGENTS.md, orCLAUDE.md.Generated by Claude Code