{{ message }}
Repository navigation
fix(a2ui-renderer): type createCatalog renderer props as the binder resolves them - #7815
Open
Laptopmini wants to merge 1 commit into
Open
Laptopmini wants to merge 1 commit into
Laptopmini wants to merge 1 commit into
Conversation
…esolves them CatalogRenderers typed each renderer's props as z.infer of the schema, the raw A2UI input shape. At runtime the GenericBinder passes resolved props: bound values as their current value, Action props as functions, and a set<Prop> setter for every bindable prop. Type them with ResolveA2uiProps from @a2ui/web_core, as createReactComponent already does for the basic catalog. Closes CopilotKit#7814
Laptopmini
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
October 14, 2026 16:36
Contributor
This branch has not been deployed
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 free
to 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.

What does this PR do?
CatalogRendererstyped each renderer'spropsasz.inferof the component schema, which is the raw A2UI input shape. A boundDynamicNumberwas typednumber | { path } | { call, … }, anActionprop was typed as the action object, and theset<Prop>setters didn't exist. At runtime, though, theGenericBinderpasses resolved props:set<Prop>setter that writes the data model.As a result, custom renderers had to cast to call an action or a setter. The basic catalog avoids the problem because
createReactComponenttypes its props withResolveA2uiPropsfrom@a2ui/web_core.This PR uses the same type for
createCatalog, soCatalogRenderersis nowComponentRenderer<ResolveA2uiProps<z.infer<D[K]["props"]>>>. The deprecatedcreateA2UICatalog'sA2UIComponentDefinition.rendergets the same change, and theRendererProps.propsdoc now describes what renderers receive.PropsOfis unchanged: it describes the definition, not what a renderer receives.Tests. The new file
src/react-renderer/__tests__/create-catalog-props.test.tsxis covered by both vitest andcheck-types:Dimmerrenderer readsprops.levelas anumberand callsprops.setLevel(…)andprops.changeLevel()with no casts. Onmainthis failscheck-typeswith 4 errors./levelthrough the setter. The dispatchedchangeLevelaction's context then reads the new value ({ to: 65 }). This part passes onmaintoo: it pins the runtime behaviour the new types describe.@ts-expect-errorchecks thatsetLevel("high")is still rejected.Checked:
a2ui-renderer:check-typespasses, and the package's tests pass (23).nx run-many -t check-typesfora2ui-rendererandreact-corepasses, without the Nx cache.test-and-check-packages.createCatalogor useCatalogRenderersacross 15 projects. Each was checked withstrict: trueagainst this branch's built declarations and against the same build with only this change reverted. 14 projects show no difference.One case to flag. Whether this counts as breaking under VERSIONING.md is your call.
ResolveA2uiProptreats any prop whose type is structurally aChildList(string[] | { componentId, path }) as a child list and resolves it toany.examples/showcases/reskinnable-demo/src/shell/chat/inline-block-surface.dom.test.tsxdeclares a plainchildren: z.array(z.string()), so with this changeprops.children.map((id) => …)reportsTS7006: Parameter 'id' implicitly has an 'any' typeunderstrict. That project pins 1.71.0, so nothing breaks today. The fix on upgrade is(id: string) =>. It's the only new error in the 15 projects. If you'd prefer this marked as breaking, I'll add the!and aBREAKING CHANGE:note.AI disclosure: written with AI assistance (Claude Code). I reproduced the issue, reviewed the change, and ran the checks above myself.
Related PRs and Issues
children(id, basePath)typing in the same interface. That's a separate line, and the two PRs don't conflict.Checklist
RendererProps.propsdoc comment)!and the description has aBREAKING CHANGE:line (see the case flagged above; not marked)Summary by CodeRabbit