Error TS2602: The JSX element is implicitly of type "any" because the global type "JSX.Element" does not exist

Despite the fact that I installed and referenced the Reaction library, for example,

/// <reference path="../../../typings/browser.d.ts" />

I still get the error below: enter image description here

Is there another Type library I need to install?

+5
source share
3 answers

There are two versions of React available in Tipik. I saw this problem with typings install react and using noImplicitAny .

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

+18
source

From a handbook , React should have a capital letter. The code in the question is clearly not consistent.

+1
source

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

 { "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" ] } 
0
source

All Articles