Skip to content

JSX namespace is not defined in react 19+ #911

Closed as not planned
Closed as not planned
@tshmieldev

Description

@tshmieldev

Initial checklist

Affected package

main package

Steps to reproduce

Make a project in NextJS (using typescript, next15)
Use React-Markdown in a client component
Run build task

Actual behavior

I am using react-markdown in Next 15 (React 19)
Doing npm run build causes this problem

./node_modules/react-markdown/lib/complex-types.ts:25:21
Type error: Cannot find namespace 'JSX'.

  23 |
  24 | export type NormalComponents = {
> 25 |   [TagName in keyof JSX.IntrinsicElements]:
     |                     ^
  26 |     | keyof JSX.IntrinsicElements
  27 |     | C
``

After researching this topic, I found the fix: Import React and replace JSX with React.JSX

I would happily make a PR with this change if you allow it

Thanks
Wojtek

### Expected behavior

Not crash, allow the build to finish (that's what happens after my fix)

### Runtime

node@23

### Package manager

npm@10.8

### Operating system

macOS Sequoia 15

### Build and bundle tools

Next.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    👎 phase/noPost cannot or will not be acted on🤷 no/invalidThis cannot be acted upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions