Description
Bug description
After upgrading to the latest version of react-tooltip, I encountered a TypeScript error in the library’s type definitions. The issue is caused by a reference to React.JSX in the TooltipWrapper declaration, which is not supported in React 17 projects using @types/react v17.
Upon investigation, I noticed that starting from [email protected], the library updated its @types/react dev dependency from 18.0.28 to ^18.2.17. This change introduces compatibility issues for projects still using @types/react v17.
Could you please confirm if this dependency bump is strictly necessary? Upgrading @types/react in my current setup is not straightforward.
Environment
- React version: 17.0.2
- React DOM version: 17.0.2
- React Tooltip version: 5.28.1
- @types/react version: 17.x
To Reproduce
- Use a React 17 project with this tsconfig.json:
{
"compilerOptions": {
"target": "ESNext",
"moduleResolution": "Node",
"allowJs": false,
"noEmit": true,
"strict": true,
"jsx": "react",
"esModuleInterop": true,
"resolveJsonModule": true,
"module": "CommonJS",
"noErrorTruncation": true,
"types": [
"node"
],
"forceConsistentCasingInFileNames": true
}
}
- Install [email protected].
- Run tsc.
Expected behavior
No errors to be reported. Typescript should build successfully
Actual Behavior
Error: node_modules/react-tooltip/dist/react-tooltip.d.ts:250:193 - error TS2694: Namespace 'React' has no exported member 'JSX'.