I have a TypeScript/React project in Visual Studio.
The challenge is getting Visual Studio to recognize React.
IntelliSense errors in Visual Studio are of the form -
“--jsx is not set”, “Cannot use JSX, unless the ‘—jsx’ flag is provided”
The obvious solution is to configure –-jsx.
There seems to be at least two way to do this -
- Visual Studio project , Project properties -> TypeScript Build –> JSX Compilation in TSX files
tsConfig.json
{ "compilerOptions": {
"jsx": "react", "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "target": "es5", ...
I have already configured -–jsx in tsConfig.json, and the command line gulp build works just fine, but Visual Studio still thinks that –jsx is not set.
So, for Visual Studio, I figured I could just set the project property ( in addition to tsconfig.json) But in Visual Studio this is disabled - “One or more tsconfig.json files detected. Project Properties are disabled”
How do I get Visual Studio to recognize the –jsx setting from the tsConfig,json. It seems to recognize that tsConfig.json exists , but does not specifically recognize that –jsx is configured
Dev Environment
- Visual Studio: 2017 Professional
- TypeScript : 2.1.4
- React : 15.4.2
tsConfig.json
file. So do not worry about what you see there. – Jack Miller