Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Lost ReactHTML type in React 19

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading