Skip to content

build: explicit React 19 support#43

Merged
chubes4 merged 1 commit into
mainfrom
react19-42
May 31, 2026
Merged

build: explicit React 19 support#43
chubes4 merged 1 commit into
mainfrom
react19-42

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented May 30, 2026

Closes #42.

Makes @extrachill/chat explicitly support React 19. The package builds with plain tsc (it does not use @wordpress/scripts, so there was no @wordpress/scripts line to bump and no React-coupled @wordpress/* devDeps to align — the issue's assumption about that toolchain doesn't apply to this repo). Support is now declared in peer ranges and verified by building + typechecking against the real React 19 toolchain.

Version bumps (before → after)

Package Before After Locked to
@types/react (devDep) ^18.0.0 ^19.0.0 19.2.15
@types/react-dom (devDep) ^18.0.0 ^19.0.0 19.2.3
react (devDep) ^18.0.0 ^19.0.0 19.2.6
react-dom (devDep) ^18.0.0 ^19.0.0 19.2.6
typescript (devDep) ^5.7.0 ^5.9.3 5.9.3

The dev react/react-dom were bumped to ^19 (not just the @types) so the build actually verifies against React 19 runtime types, not just the type packages.

Peer-range change

Peer Before After
react >=18.0.0 ^18.0.0 || ^19.0.0
react-dom >=18.0.0 ^18.0.0 || ^19.0.0

The old >=18.0.0 loosely satisfied 19 but was unverified; the explicit ^18 || ^19 range states support intentionally while still allowing React 18 consumers.

Type fallout fixed

Audited the whole src tree (all hooks + the REST client in src/api.ts) for the known React-19 type breakers — JSX.Element annotations (none), React.FC implicit children (none), legacy ReactDOM.render (none), and zero-arg useRef(). One real break:

  • src/components/TypingIndicator.tsx:31useRef<ReturnType<typeof setTimeout>>() called with a type param and zero args. Under @types/react@19 the no-argument useRef overload was removed, producing error TS2554: Expected 1 arguments, but got 0. Fixed by passing an explicit initial value: useRef<ReturnType<typeof setTimeout> | undefined>(undefined).

No @wordpress/* packages are imported by this library, so no ambient declare module shims were needed.

Verification

  • npm install resolves the lockfile to @types/react@19.2.15 (confirmed in package-lock.json).
  • npm run build (tsc) → exit 0
  • npx tsc --noEmitexit 0 ✅ (no dedicated typecheck script exists; used the tsc --noEmit fallback)

Out of scope (per repo rules)

  • CHANGELOG.md untouched and version string not bumped — homeboy owns both.

Bump dev/build toolchain to React-19-aware versions and widen peer
ranges to cover React 19. The package builds with plain tsc (no
@wordpress/scripts), so the toolchain bump is @types/react@19,
@types/react-dom@19, react/react-dom@19 devDeps, and typescript@5.9.3.

Fix the one React-19 type fallout: useRef() with a type param and zero
args is no longer permitted under @types/react@19; pass an explicit
undefined initial value.

Closes #42
@chubes4 chubes4 merged commit cdc2203 into main May 31, 2026
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.

Refactor for explicit React 19 support

1 participant