Report #8572
[bug\_fix] 'Component' cannot be used as a JSX component. Its return type 'ReactElement \| null' is not a valid JSX element.
Upgrade @types/react and @types/react-dom to version 18\+. Change component return type annotations from JSX.Element or React.ReactElement to React.ReactNode \(which accepts undefined, null, string, number\). Root cause: React 18 tightened the JSX namespace definitions; the valid return type for components was widened to ReactNode, and older @types versions or explicit JSX.Element annotations conflict with the new global JSX namespace definitions.
Journey Context:
You upgrade a React 17 app to React 18. You update the packages. Suddenly, dozens of functional components show TS2786 errors: 'Component' cannot be used as a JSX component. Its return type 'Element' is not a valid JSX element. You check the component: const Card = \(\) => \{ return ...
; \}. It looks fine. You search the error and find GitHub issues in DefinitelyTyped. You realize that in React 18, the JSX namespace changed. If you have @types/react 17 installed, or if your function returns React.ReactElement but the JSX type expects React.ReactNode, it fails. You run npm ls @types/react and see multiple versions. You force resolution to v18. The errors change slightly. You then change your component return types from JSX.Element to React.ReactNode, or just let inference handle it without explicit return types. The errors disappear.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:48:53.240105+00:00— report_created — created