Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 23933ae

Browse files
baozhoutaoclaude
andauthored
docs(core): compile every README snippet and leave the UNGATED_DOCS ledger (#8132)
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. Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5533ae3 commit 23933ae

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

‎packages/core/README.md‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ const mySchema: PageNodeSchema = {
4545

4646
```typescript
4747
import { ComponentRegistry } from '@object-ui/core'
48+
import type { ComponentRenderer } from '@object-ui/core'
4849

49-
ComponentRegistry.register('button', buttonMetadata)
50-
const metadata = ComponentRegistry.get('button')
50+
// Your component, in whatever renderer shape the host framework uses.
51+
declare const buttonRenderer: ComponentRenderer
52+
53+
ComponentRegistry.register('button', buttonRenderer)
54+
const renderer = ComponentRegistry.get('button')
5155
```
5256

5357
`ComponentRegistry` is a process-level singleton exported by `@object-ui/core`;
5458
`SchemaRenderer` resolves every `type` against it, so a component registered
55-
here is renderable from schema anywhere in the app.
59+
here is renderable from schema anywhere in the app. `register()`'s second
60+
argument is the component itself; registration metadata is its optional third
61+
argument, and `getMeta()` — not `get()` — reads that metadata back.
5662

5763
### Data Scope
5864

@@ -82,6 +88,14 @@ object scope, which are injected:
8288

8389
```typescript
8490
import { createServerActionHandler } from '@object-ui/core'
91+
import type { ActionRunner, ServerActionFetch } from '@object-ui/core'
92+
93+
// Injected by the host. Each stand-in is typed from the shipped surface, so
94+
// this example is checked against the factory's own config rather than a copy.
95+
declare const myAuthenticatedFetch: ServerActionFetch
96+
declare const currentObject: string | undefined
97+
declare const refetchData: () => void
98+
declare const runner: ActionRunner
8599

86100
const script = createServerActionHandler({
87101
fetch: myAuthenticatedFetch, // your auth wrapper (Bearer/cookies/...)
@@ -116,6 +130,7 @@ export const userListView = defineSystemView({
116130
columns: [{ name: 'email' }],
117131
})
118132

133+
// @ts-expect-error readonly by defineSystemView — refused at compile time, not just at run time
119134
userListView.columns.push({ name: 'name' }) // ❌ TypeError (strict mode)
120135
isSystemView(userListView) // ✅ true
121136

‎scripts/check-doc-snippet-types.mjs‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,6 @@ const UNGATED_DOCS = {
705705
'what is left is fragment shape, and no gate reads this page\'s import names.',
706706
'packages/auth/README.md':
707707
'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',
708-
'packages/core/README.md':
709-
'5 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the ' +
710-
'page never defines; plus TS2339x1 — TRIAGED, and NOT a defect: the remaining one is ' +
711-
'`userListView.columns.push(...) // ❌ TypeError (strict mode)`, the System-View immutability ' +
712-
'demonstration, so a readonly rejection there is the documentation working as written. ' +
713-
'This entry read TS2339x2 until objectui#5257: the second one, on the `cloneAsOverride` draft ' +
714-
'one block below, was a real signature defect — `cloneAsOverride` returned its input type, so ' +
715-
'the documented override flow did not compile. It now returns `DeepMutable<T>` and that ' +
716-
'diagnostic is gone. Covering this page still needs the 5 undefined-name blocks made ' +
717-
'self-contained or declared, plus a way to declare a block whose rejection IS the point.',
718708
'packages/fields/README.md':
719709
'2 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; 1 unresolved-module diagnostic(s)',
720710
'packages/plugin-ai/README.md':

0 commit comments

Comments
 (0)