Skip to content

fix(sdk): accept key on intrinsic elements - #77

Merged
SunkenInTime merged 1 commit into
masterfrom
fix/jsx-key-on-intrinsics
Sep 6, 2026
Merged

SunkenInTime merged 1 commit into
masterfrom
fix/jsx-key-on-intrinsics

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

<column key={day}> failed weaver check with TS2322 ("Property 'key' does not exist on type 'GradientBoxProps'"). Under jsx: "react-jsx" TypeScript checks a keyed intrinsic's props against IntrinsicElements[tag] directly, so the existing JSX.IntrinsicAttributes.key never applied to intrinsics.

Adds a KeyedProps interface to BoxProps, TextProps, and IconProps. The reconciler already forwards key (the jsx() factory merges it into props) and uses it for positional diffing, so this is purely a typing gap.

Receipts

  • New cli/test/jsx-key.test.mjs: keyed <column>, <text>, and <icon> inside a .map() pass weaver check. Fails on master, passes here.
  • npm run typecheck and npm test: 118 passed.

Why it matters

Eight of twenty agents in the render-loop cadence experiment (experiments/render-loop-cadence/SYNTHESIS.md, finding 5) wrote key on a mapped intrinsic, hit this, and spent a check round removing it.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Under jsx: "react-jsx" TypeScript checks a keyed intrinsic's props against
IntrinsicElements[tag] directly, so JSX.IntrinsicAttributes alone did not
admit key on <column>, <text>, <icon>, and friends. Every mapped list of
children hit TS2322 and lost a check round to it; eight of twenty agents in
the render-loop cadence experiment did.

The reconciler already reads key for positional diffing (jsx() merges it
into props), so this is a typing gap, not a runtime one. Add KeyedProps to
BoxProps, TextProps, and IconProps; add a check regression test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown

Greptile Summary

Widget authors can now use stable key values on every Weaver intrinsic JSX element. Validation confirmed that keyed mapped elements compile, invalid boolean keys remain rejected, and automatic JSX keys continue to preserve retained-tree identity during reconciliation.

Confidence Score: 5/5

The change is safe to merge: intrinsic key typing and runtime key propagation both behaved as intended.

All intrinsic element kinds were compiled with valid string and numeric keys, invalid boolean keys were rejected, and a before-and-after runtime harness verified keyed reordering without node removal. The focused CLI test and repository typecheck also completed successfully.

Files Needing Attention: No files need follow-up attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex traced the automatic JSX key flow from the factory into VNode.key and through keyed child reconciliation, then ran the keyed-reorder harness on both the parent revision and the new revision to confirm the key is preserved and existing nodes reorder without removals, and executed the focused mapped-intrinsic-key CLI test successfully.
  • T-Rex inspected the shared KeyedProps declaration and its propagation to every intrinsic element family, built an all-intrinsic compatibility matrix showing valid keys failed before the change and pass after, while boolean keys remain rejected, and ran the repository SDK and CLI typecheck successfully.
  • T-Rex captured exact code evidence of the key flow through the reconciler (VNode.key declaration, h() writing the key, JSX forwarding, host reuse comparison, and child matching), verified that before/after runtime behavior is the same, and uploaded four supporting evidence artifacts.
  • T-Rex gathered declaration/diff evidence showing valid string/number keys are accepted after the change and boolean keys are rejected via ts-expect-error, and verified a full project typecheck with SDK and CLI passes.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(sdk): accept key on intrinsic elemen..." | Re-trigger Greptile

@SunkenInTime
SunkenInTime merged commit 2e2988b into master Sep 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant