TS17004: Cannot use JSX unless the '--jsx' flag is provided. code example

Example 1: Cannot use JSX unless the '--jsx' flag is provided.

// Well I worked around it by adding 
 "jsx": "react" 
// to tsconfig.json, as far as I can tell,
// but that is missing the point.

// When you open a TSX file (not a directory), 
// you don't have a tsconfig.json file.

Example 2: Cannot use JSX unless the '--jsx' flag is provided.ts(17004)

// 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.