From 775ccf34e9134b8914a106f08f89d6a6ce23db0d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 17:14:37 +0000 Subject: [PATCH] docs(core): compile every README snippet and leave the UNGATED_DOCS ledger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #5174 — batch 25 of the UNGATED_DOCS burn-down. `packages/core/README.md` leaves the ledger; every ts/tsx block on the page now compiles against the built types. The gate file's only change is the ten lines of that one entry, removals only. The five TS2304 are paid down with real self-imports plus `declare const` stand-ins typed from the shipped surface (`ComponentRenderer`, `ServerActionFetch`, `ActionRunner`), never a lenient alias. The surviving TS2339 is the System-View immutability demonstration, whose rejection IS the documentation: the line stays and carries a `@ts-expect-error` with its reason, which pins the property in both directions. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --- packages/core/README.md | 21 ++++++++++++++++++--- scripts/check-doc-snippet-types.mjs | 10 ---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 807bec8aee..c16b161b07 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -45,14 +45,20 @@ const mySchema: PageNodeSchema = { ```typescript import { ComponentRegistry } from '@object-ui/core' +import type { ComponentRenderer } from '@object-ui/core' -ComponentRegistry.register('button', buttonMetadata) -const metadata = ComponentRegistry.get('button') +// Your component, in whatever renderer shape the host framework uses. +declare const buttonRenderer: ComponentRenderer + +ComponentRegistry.register('button', buttonRenderer) +const renderer = ComponentRegistry.get('button') ``` `ComponentRegistry` is a process-level singleton exported by `@object-ui/core`; `SchemaRenderer` resolves every `type` against it, so a component registered -here is renderable from schema anywhere in the app. +here is renderable from schema anywhere in the app. `register()`'s second +argument is the component itself; registration metadata is its optional third +argument, and `getMeta()` — not `get()` — reads that metadata back. ### Data Scope @@ -82,6 +88,14 @@ object scope, which are injected: ```typescript import { createServerActionHandler } from '@object-ui/core' +import type { ActionRunner, ServerActionFetch } from '@object-ui/core' + +// Injected by the host. Each stand-in is typed from the shipped surface, so +// this example is checked against the factory's own config rather than a copy. +declare const myAuthenticatedFetch: ServerActionFetch +declare const currentObject: string | undefined +declare const refetchData: () => void +declare const runner: ActionRunner const script = createServerActionHandler({ fetch: myAuthenticatedFetch, // your auth wrapper (Bearer/cookies/...) @@ -116,6 +130,7 @@ export const userListView = defineSystemView({ columns: [{ name: 'email' }], }) +// @ts-expect-error readonly by defineSystemView — refused at compile time, not just at run time userListView.columns.push({ name: 'name' }) // ❌ TypeError (strict mode) isSystemView(userListView) // ✅ true diff --git a/scripts/check-doc-snippet-types.mjs b/scripts/check-doc-snippet-types.mjs index aa352458ae..aef42073f6 100644 --- a/scripts/check-doc-snippet-types.mjs +++ b/scripts/check-doc-snippet-types.mjs @@ -705,16 +705,6 @@ const UNGATED_DOCS = { 'what is left is fragment shape, and no gate reads this page\'s import names.', 'packages/auth/README.md': '1 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 15 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; plus TS2741x1 — candidate real defects, un-triaged', - 'packages/core/README.md': - '5 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the ' + - 'page never defines; plus TS2339x1 — TRIAGED, and NOT a defect: the remaining one is ' + - '`userListView.columns.push(...) // ❌ TypeError (strict mode)`, the System-View immutability ' + - 'demonstration, so a readonly rejection there is the documentation working as written. ' + - 'This entry read TS2339x2 until objectui#5257: the second one, on the `cloneAsOverride` draft ' + - 'one block below, was a real signature defect — `cloneAsOverride` returned its input type, so ' + - 'the documented override flow did not compile. It now returns `DeepMutable` and that ' + - 'diagnostic is gone. Covering this page still needs the 5 undefined-name blocks made ' + - 'self-contained or declared, plus a way to declare a block whose rejection IS the point.', 'packages/fields/README.md': '2 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; 1 unresolved-module diagnostic(s)', 'packages/plugin-ai/README.md':