error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist reactjs reactjs

error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist


I resolved this issue by installing the react type definition.

Try to run yarn add --dev @types/react


There are two versions of React available in Typings. I've seen this issue with typings install react and using noImplicitAny.

I resolved this by installing the global version: typings install dt~react --globaltypings search react results


Put this configuration in the tsconfig.json file so that the ts server does not recognize that type of errors

{    "compilerOptions": {        "outDir": "build/dist",        "module": "commonjs",        "target": "es5",        "lib": ["es6", "dom"],        "sourceMap": true,        "allowJs": true,        "jsx": "react",        "moduleResolution": "node",        "rootDir": "src",        "noImplicitReturns": true,        "noImplicitThis": true,        "noImplicitAny": true,        "strictNullChecks": true    },    "exclude": [        "node_modules",        "build",        "scripts",        "acceptance-tests",        "webpack",        "jest",        "src/setupTests.ts"    ],    "types": [        "typePatches"    ]}