Build: Cannot use JSX unless the '--jsx' flag is provided Build: Cannot use JSX unless the '--jsx' flag is provided typescript typescript

Build: Cannot use JSX unless the '--jsx' flag is provided


I added "jsx": "react" to my tsconfig.json to resolve this error:

{    "compileOnSave": true,    "compilerOptions": {        "target": "es6",        "outFile": "Content/app.js",        "sourceMap": true,        "jsx": "react"    }}


Adding this to the csproj worked for me in VS2015:

<PropertyGroup>  <TypeScriptJSXEmit>react</TypeScriptJSXEmit></PropertyGroup>

From: Working around "Cannot use JSX unless the '--jsx' flag is provided." using the TypeScript 1.6 beta


In your tsconfig.json add a property jsx with react value "jsx": "react". Second, you should also include the file to reflect the compiler options like this (index.tsx).

{    "compilerOptions": {        "outDir": "./build/",        "sourceMap": true,        "noImplicitAny": true,        "module": "commonjs",        "target": "es5",        "jsx": "react"    },    "files": [        "./src/app/index.tsx"    ]}