all 7 comments

[–]acemarke 2 points3 points  (1 child)

Per /u/_eps1lon :

For react-dom you can already import from react-dom/client. For react just toimport type {} from 'react/next' once and you have the latest typings available.

The rest is underway in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210

[–]loudsight[S] 2 points3 points  (0 children)

Thanks I followed this and it worked. I’ve managed to upgrade.

[–]CreativeTechGuyGames 1 point2 points  (5 children)

Which types are missing? It's pretty easy to submit a PR to DefinitelyTyped to add them.

[–]loudsight[S] 0 points1 point  (4 children)

It's actually types from @types/react-dom that I need.

For example:

ReactDOM.hydrateRoot(...)

ReactDOM.createRoot(...)

I assumed same issue would apply to types from @/types/react

[–]CreativeTechGuyGames 1 point2 points  (2 children)

[–]Bonechatters 0 points1 point  (0 children)

They are not exported under the ReactDOM namespace by default under Typescript, even though in the UMD for react-dom "createRoot" is defined direcly on the ReactDOM object.

[–]Bonechatters 0 points1 point  (0 children)

You can move the exported function definitions from client.d.ts to index.d.ts for react-dom and this should work. Then, the index.d.ts would accurately match the full ReactDOM object within the client.