Skip to content

feat(target-react): emit cross-file types and generics - #75

Merged
alexgrozav merged 2 commits into
milestone-m5-uxf-443from
react-types-generics-uxf-462
Oct 29, 2026
Merged

alexgrozav merged 2 commits into
milestone-m5-uxf-443from
react-types-generics-uxf-462

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

What changed

Cross-file types and generic components on React (ADR-0067, ADR-0068). Only React's output changes.

  • React: import type by name where the output reads the type: ./types or a package as written, and a child's types from its output (import Field, { type FieldProps } from "./Field"). The output of a module's main component writes the module's type exports and re-exports in source order among the types it copies. A generic component is a generic function component, function List<T>(…), with its constraints and defaults as written. The events', models' and slots' interfaces whose members name a type parameter take the parameters too (PickerSlots<T>). A <select>, text field or textarea bound to a model of such a type casts its string value to it (event.target.value as T), which TypeScript can't narrow on its own.
  • Cases: React's goldens for types/ (8), generics/ (4) and diagnostics/generic-slot-props, with React consumer fixtures for the 12 rendering cases, including the type and generic misuses. No shared expectation changes.
  • Quarantine: React's 12 L4 entries are gone, and its test helpers read these cases again.
  • Harness: the canary injector now finds the body of a generic function component (function List<T extends { id: string }>(…) {), with a unit test. Without it, the L3, L5 and L13 canaries fail on React's generic outputs.

Parity matrix

  • types/ and generics/, every target: compile 84 tests, toolchain:* 84, ssr:* 126, and browser:* 113 passed and 1 skipped (Astro, interactivity). Angular's browser project ran from a checkout whose path holds no .ts: 38 passed.
  • Every project, from a checkout whose path holds no .ts: 8817 passed, 242 skipped, 12 failed. The 12 failures are locator.screenshot timeouts at L10 on Angular, Svelte, Solid and Qwik, none of them on React. The matrix shows no missing cell and no stale entry.
  • pnpm test:canaries L4 L3-mismatched-closing-tag L5-debugger L5-framework-rule: all caught on every target.

Checklist

  • The title follows Conventional Commits, as in feat(web): sell the next framework on the homepage.
  • pnpm format:check, pnpm lint, pnpm check-types and pnpm test pass. (The first three pass. In place of pnpm test: React's package tests, the harness and repo tests, and the whole integration suite as above.)
  • Changes to a published package: a changeset from pnpm changeset (see .changeset/README.md).
  • Homepage changes: pnpm build, then pnpm --filter web lighthouse, still scores at least 0.95 in every category.

React's output imports the types its source imports by name, from a
`.ts` module or a package as written and from a child's output, and the
main component's output writes the module's type exports in source
order (ADR-0067, ADR-0068). A generic component is a generic function
component, and the events', models' and slots' interfaces whose members
name a type parameter take it too. A form control bound to a model of
such a type casts its string value to it.

The types and generics cases pass every live layer on React, with
consumer fixtures for each, so React's quarantine is empty again and
its test helpers read these cases. The canary injector also finds the
body of a generic function component.

Co-authored-by: multica-agent <github@multica.ai>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://react-types-generics-uxf-462-unframework.blue-water-0397.workers.dev (commit e4d1057)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://dd20dca1-unframework.blue-water-0397.workers.dev e4d1057 2026-10-29T08:30:23.675Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://10ea2480-unframework.blue-water-0397.workers.dev e10273f 2026-10-28T12:14:40.800Z Visit the dashboard ↗

…terfaces

Setup code that a type parameter types stays inside a generic function
component instead of being hoisted to module scope. The handle and the
attributes interface take the type parameters an exposed function
names, and every interface declares only the parameters its members
name, with those their constraints and defaults name. A multiple select
casts its values to a generic model's type, and a field bound to state
whose type is inferred casts to that state's type. React's own
interface names no longer take a name the module imports or exports as
a type.

Co-authored-by: multica-agent <github@multica.ai>
@alexgrozav
alexgrozav merged commit 86073ce into milestone-m5-uxf-443 Oct 29, 2026
49 checks passed
@alexgrozav
alexgrozav deleted the react-types-generics-uxf-462 branch October 29, 2026 08:57
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