The stable version of React 19 has been released, and I’m in the process of updating it in our project. However, one of the breaking changes I’ve encountered is the absence of the ReactHTML type, which I previously imported like this:
import type {ReactHTML} from 'react'
In earlier versions, this type was defined within the React namespace in @types/react/index.d.ts, and it looked something like this:
declare namespace React {
// ...
//
// React.DOM
// ----------------------------------------------------------------------
interface ReactHTML {
a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
// ...
However, in React 19, this type no longer exists or is no longer exported.
Does anybody know an alternative?
>Solution :
Per the PR notes, you can still access it from @types/react-dom-factories (import type { ReactHTML } from 'react-dom-factories';), or, if you needed typeof ReactHTML, you should use HTMLElementType instead.