TS4060

error TS4060: Return type of exported function has or is using private name ‘JSX’.

Broken Code ❌

1
2
3
4
5
function App(): JSX.Element {
return <p>My App!</p>;
}

export default App;

Fixed Code ✔️

The global JSX namespace is declared in @types/react. You have to install the @types/react package to make use of it:

1
yarn add --dev @types/react