xxxxxxxxxx
Cannot use JSX unless the '--jsx' flag is provided
Restart your IDE. Sometimes tsconfig.json changes aren't immediately picked up
xxxxxxxxxx
// Inside of tsconfig, include was set only to /src, Change to:
"include": [
"./src/**/*.ts"
]
xxxxxxxxxx
// Open tsconfig.json and uncomment line:
"jsx": "preserve", /* Specify what JSX code is generated. */
// If you don't have tsconfig.json file, run in terminal:
npm i typescript
tsc --init
// Note that I'm using Gatsby. Idk if that matters in this particular case.
xxxxxxxxxx
// if "jsx": "react" is being overwritten, do this if on VSCode editor:
// 1. Go to the command palette CTRL+Shift+P.
// 2. Choose "TypeScript: Select a TypeScript Version...".
// 3. Choose "Use workspace Version".
//Should be sorted, The problem is VSCode using an older version of typescript, while the typescript version shipped with the project is a later version.