diff --git a/.changeset/25918-renderer-props-unknown-index.md b/.changeset/25918-renderer-props-unknown-index.md new file mode 100644 index 00000000000..f300c0dba05 --- /dev/null +++ b/.changeset/25918-renderer-props-unknown-index.md @@ -0,0 +1,31 @@ +--- +'@object-ui/types': patch +'@object-ui/components': patch +--- + +fix(types,components)!: a renderer's props index signature is `unknown`, not `any`, so a forwarded key must be narrowed before it is used + +Clause-②: yes (narrowing) +Metadata-protocol: none + + + +**BREAKING** type-surface narrowing, compile-time only. Nothing a renderer receives or renders at runtime changes. + +- **`@object-ui/types`.** `ComponentRendererProps` keeps its index signature, so every key the host forwards is still admitted, but the signature now maps to `unknown` instead of `any`. +- **`@object-ui/components`.** The built-in renderers' own inline props annotations move the same way. The three host keys renderers read by name and pass to their root element (`data-obj-id`, `data-obj-type` and `style`, written or forwarded by `SchemaRenderer`) are declared once in a package-local type instead. The host-supplied callbacks and values a renderer reads by name (`onPageChange` on `pagination`, `onChange` / `value` on `input-otp`, `loading` on `button`, `className` on `text`, react-hook-form's `ref` on the form's built-in controls) are declared on that renderer's props. + +**Migration.** A renderer typed with `ComponentRendererProps` that reads a forwarded key: + +```ts +// FROM — compiled, because the key was `any` +const Pager = ({ schema, ...props }: ComponentRendererProps) => +