Repository navigation
Commit f486e9c
fix(types,components)!: renderer props index signatures map to unknown, not any (#26293)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi911oA3FnMcWttjcfML6MnUg)_
Part of #25918. This PR is the triage in-scope item named in the claim:
`ComponentRendererProps` and the inline renderer props copies under
`ui/packages/components/src/renderers/**` move from an index signature
to `any` to one to `unknown`. #25918 remains open for the other items:
the `(schema as any)` reads in ListView / ObjectGrid / ObjectView (a
separate slice), and the `no-explicit-any` lint gate on
`ui/packages/types/src`, which triage holds out of scope until the
maintainer names it. No ESLint config change here.
Clause-②: yes (narrowing)
Metadata-protocol: none
## What changed
- **`@object-ui/types`**: `ComponentRendererProps` keeps its index
signature (forwarded keys stay admitted, the SchemaRenderer forward path
is untouched), but the signature maps to `unknown`, so a renderer has to
narrow a forwarded key before it uses it.
- **`@object-ui/components`**: the 77 renderer props annotations (74
files) that carried an index signature to `any` now carry one to
`unknown`. The class of reads that broke is declared, not cast:
- `RendererHostProps` (new, package-local,
`src/lib/renderer-host-props.ts`) types the three host keys renderers
read by name and hand to their root element: `data-obj-id`,
`data-obj-type` (written by `SchemaRenderer` from the node's `id` /
`type`) and `style` (forwarded from `BaseSchema.style`). It is
intersected into the 49 annotations that read them.
- Host-supplied keys a single renderer reads by name are declared on
that renderer: `onPageChange` (`pagination`), `onChange` / `value`
(`input-otp`), `loading` (`button`), `className` (`text`), and on the
form's internal `RenderFieldProps` react-hook-form's `ref`
(`RefCallBack`), `field` and `emptyHint`.
- `filter-builder` needs no cast: main's #26306 declared `value?:
FilterGroup` on the renderer schema, so the read type-checks as written
(seat note, head `b9a43f1d`).
- Changeset: `.changeset/25918-renderer-props-unknown-index.md` (`patch`
on both packages, BREAKING type narrowing, FROM → TO migration for a
renderer typed with `ComponentRendererProps`).
- sdui: no records. Since #26367 the per-package records are retired;
the merge of `main` dropped
`scripts/sdui-manifest.sources/{types,components}.json`, and CI's Build
& E2E UI regenerates `sdui.manifest.json` itself.
## Measured (origin/main 617f27e + this branch)
- Step 0, the `base.ts` one-liner alone: 0 type errors in
`@object-ui/components`, `@object-ui/types`, `@object-ui/react` and
`@object-ui/core` (`type-check`, both programs each).
`ComponentRendererProps` has no renderer consumer; its only readers are
the reconciliation pin in `@object-ui/react` and the closed-face pin in
`@object-ui/types`, which asserts the index signature exists and stays
green.
- Flipping the inline copies alone: 65 errors in 49 files on components'
`tsc --noEmit`; about 45 of them were the host-key class above.
- Public surface: none of the renderer props types is exported from
`@object-ui/components`' entry (`src/index.ts`), so no downstream
package's type-check reads them; `ComponentRendererProps` has no
consumer outside the two pins.
## Tests and gates (head `b9a43f1d`; earlier readings at 67418d8 /
e349c83 kept where still true)
- `pnpm --filter @object-ui/components type-check`: exit 0 (`tsc
--noEmit && tsc -p tsconfig.test.json`). `@object-ui/types`,
`@object-ui/react`, `@object-ui/core` `type-check`: exit 0.
- `pnpm --dir ui exec vitest run packages/components/ packages/types/
packages/react/src/__tests__/ComponentRendererProps.reconciliation.test.ts
--maxWorkers=2`: Test Files 826 passed, 1 skipped (827); Tests 14866
passed, 24 skipped.
- At head `b9a43f1d` (merge of `main` `e890bedc`), `node
scripts/check-adr-0087-registration.mjs --base origin/main` exits 0:
"verified: ui/packages/types/src/base.ts#ComponentRendererProps ([key:
string]: any -> [key: string]: unknown)". The gate now reads ui packages
(#26319) and admits an `any` → `unknown` index-signature change (D8, ADR
amendment #26455, gate #26496). The changeset keeps `type-surface-only`.
dispatch-gates: 28 derived, 28/28 at `b9a43f1d`.
- Dogfood full battery (owed for the `(narrowing)` arm), on head
`b9a43f1d`, run as CI runs it (build `@objectstack/dogfood^...`, then
`pnpm --filter @objectstack/dogfood test`): command exit 0. Test Files
300 passed, 3 skipped (303); Tests 2494 passed, 18 skipped (2512).
## Acceptance notes
- `ActionGroupSchema` and `ActionMenuSchema` (in `action-group.tsx` /
`action-menu.tsx`) are exported schema interfaces, not renderer props,
and still carry an index signature to `any`; they are outside this claim
and left byte-identical.
- `html-elements.tsx`'s shared `AnyProps` now has an `unknown` index
signature but still types `schema: any`; that member is not an index
signature and is outside this claim.
- `filter-builder`: the `FilterGroup` / `FilterBuilderRowGroup` gap is
closed on `main` by #26306, so this PR no longer carries a cast there.
- `ui/AGENTS.md` #0.1 says renderer props keep their signature
(tolerance); the signature is kept as an index signature, only its value
type changes, which is the triage item's own wording ("forwarded keys
stay admitted").
---
_Generated by [Claude
Code](https://claude.ai/code/session_01GJjkZ6pmdwWoDYH8fE8FAn)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 416d9dd commit f486e9c
77 files changed
Lines changed: 199 additions & 82 deletions
File tree
- .changeset
- ui/packages
- components/src
- lib
- renderers
- action
- basic
- complex
- data-display
- disclosure
- feedback
- form
- layout
- overlay
- types/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | | - | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | | - | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
210 | | - | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments