remarkjs / react-markdown

Markdown component for React
https://remarkjs.github.io/react-markdown/
MIT License
13.26k stars 876 forks source link

Replace `JSX` global with explicit `ReactElement` #837

Closed remcohaszing closed 4 months ago

remcohaszing commented 4 months ago

Initial checklist

Description of changes

This makes the react-markdown types compatible with React 19. Dependencies still rely on the JSX namespace, but let’s trackle one thing at a time.

The better return type would be ReactNode, not ReactElement. But that breaks compatibility with TypeScript < 5.1. Let’s do that in a semver major.

github-actions[bot] commented 4 months ago

Hi! This was closed. Team: If this was merged, please describe when this is likely to be released. Otherwise, please add one of the no/* labels.

remcohaszing commented 4 months ago

The second commit was needed, because apparently type-coverage started failing.

wooorm commented 4 months ago

It was likely possible to side-step that with less changes: It didn’t get ReturnType<typeof Markdown>, for some reason, presumably JSX.Element, ReactNode, ReactElement, would’ve worked. Or a comment to ignore that one line?