Upgrading to `@types/react@v19+` and `@types/react-dom@v19+` cannot find namespace 'JSX'
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
I have a boilerplate project setup using `tsup` and `react@v19`...
```jsonc
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@repo/eslint-config": "*",
"@repo/release-it-config": "*",
"@repo/typescript-config": "*",
"@types/react": "18.3.14",
"@types/react-dom": "18.3.2",
"eslint": "^9.18.0",
"tsup": "^8.3.5",
"typescript": "^5.7.3"
},
```
But, when I try to upgrade the `@types/react` and `@types/react-dom`, `tsup` throws a `TS2503: Cannot find namespace 'JSX'` error.
```shell
...
DTS Build start
│ src/button.tsx(6,62): error TS2503: Cannot find namespace 'JSX'.
│
│ Error: error occurred in dts build
│ at Worker. (/Users/code/my-project/node_modules/tsup/dist/index.js:1541:26)
│ at Worker.emit (node:events:524:28)
│ at MessagePort. (node:internal/worker:267:53)
│ at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)
│ at MessagePort. (node:internal/per_context/messageport:23:28)
│ DTS Build error
│ npm error Lifecycle script `build` failed with error:
│ npm error code 1
│ npm error path /Users/code/my-project/packages/lib
│ npm error workspace my-project@0.11.0
│ npm error location /Users/code/my-project/packages/lib
│ npm error command failed
│ npm error command sh -c tsup
│
│ command finished with error: command (/Users/code/my-project/packages/lib) /Users/P2185561/.nvm/versions/node/v22.13.1/bin/npm run build exited (1)
Contributor guide
Research direction
Start with the package versions and the failing declaration build shown in the issue, then inspect src/button.tsx and the tsup build configuration. Reproduce the TS2503 error after upgrading @types/react and @types/react-dom, and verify that the declaration build completes successfully without the missing JSX namespace error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100