Upgrading to typescript 4.1 which apparently introduced React 17 JSX Factories causes the error Cannot assign to read only property 'jsx' of object when using .tsx file.
Yes
Environment Info:
current version of create-react-app: 4.0.0
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Binaries:
Node: 15.0.1 - ~/.nvm/versions/node/v15.0.1/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 7.0.3 - ~/.nvm/versions/node/v15.0.1/bin/npm
Browsers:
Chrome: 87.0.4280.67
Edge: Not Found
Firefox: 82.0.3
Safari: 14.0
npmPackages:
react: ^17.0.1 => 17.0.1 (16.14.0)
react-dom: ^17.0.1 => 17.0.1 (16.14.0)
react-scripts: ^4.0.0 => 4.0.0
Upgrade to typescript 4.1.2 using tsx files causes the error

Also reproducible in a brand-new project created with --template typescript
Facing same issue :/
I was just trying the new JSX Transform but seems that while trying in a TS template this error just pops up
also stumbled across this issue --
after rolling back typescript and changing jsx to react in tsconfig I was able to get 'npm start' to work.
npm install [email protected]
tsconfig.json:
"jsx": "react"
probably not a long lasting workaround though
use react-app-rewired and customize-cra
in config-overrides.js add
const immer = require('react-dev-utils/immer');
immer.setAutoFreeze(false);
to disable immer auto freeze maybe work
Facing the same issues with Typescript 4.0.3
I had the same issue with : npx create-react-app my-app --template typescript
like @fedellen said, downgrading typescript to 4.0.5 worked for me
Here's a patch to temporarily get around the issue
(or go to node_modules\react-scripts\scripts\utils\verifyTypeScriptSetup.js , comment out line 239, and run patch-package react-scripts)
diff --git a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
index 00139ee..5092ec7 100644
--- a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
+++ b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
@@ -236,7 +236,7 @@ function verifyTypeScriptSetup() {
);
}
} else if (parsedCompilerOptions[option] !== valueToCheck) {
- appTsConfig.compilerOptions[option] = value;
+ // appTsConfig.compilerOptions[option] = value;
messages.push(
`${coloredOption} ${chalk.bold(
valueToCheck == null ? 'must not' : 'must'
Facing same issue with TS 4.0.3
Downgrading Typescript version helped me. And in tsconfig.json change "react-jsx" to "react". It seems that after a while it will be fixed
Downgrading Typescript version helped me. And in tsconfig.json change "react-jsx" to "react". It seems that after a while it will be fixed
Hey @Alekseyideas , to which version did you downgrade it to?
Without downgrading, I tried replacing "react-jsx" to "react". But that didn't work.
Hi @convexhull, downgrade to "4.0.5", after downgrade reinstall node-modules
Hello guys, after installing using:
yarn create react-app my-app --template typescript
In the package.json, we have "typescript": "^4.0.3",
In the tsconfig.json, just change the param "jsx" from "react-jsx" to "react" and it worked.
Most helpful comment
Also reproducible in a brand-new project created with
--template typescripthttps://github.com/Hillshum/jsx-readonly