Error on freshly setup ionic project: Argument for '--jsx' option

Argument for ‘–jsx’ option must be: ‘preserve’, ‘react-native’, ‘react’.

This project was setup by AppFlow in my Github account. However, on trying to edit the project I get the error above.

Update: I tried to set a different value to “jsx” as suggested in the error message and launch ionic serve … but it seems my changes to tsconfig.json are overwritten and the original value of “react-jsx” is restored.

$ ionic serve

react-scripts start
[react-scripts] The following changes are being made to your tsconfig.json file:
[react-scripts] - compilerOptions.jsx must be react-jsx (to support the new JSX transform in React 17)

Indeed react-scripts seems to be forcing the value of “react-jsx”

The root cause is described here facebook/create-react-app#10144 (comment)
The fix is to make the editor (VS Code) use the project’s typescript version

Step 1

Ctrl + Shift + P

image

Step 2

Use workspace version

image