Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix noFallthroughCasesInSwitch/jsx object is not extensible #9921

Merged
merged 2 commits into from
Oct 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function verifyTypeScriptSetup() {
jsx: {
parsedValue:
hasJsxRuntime && semver.gte(ts.version, '4.1.0-beta')
? ts.JsxEmit.ReactJsx
? ts.JsxEmit.ReactJSX
: ts.JsxEmit.React,
value:
hasJsxRuntime && semver.gte(ts.version, '4.1.0-beta')
Expand Down Expand Up @@ -218,6 +218,14 @@ function verifyTypeScriptSetup() {
if (appTsConfig.compilerOptions == null) {
appTsConfig.compilerOptions = {};
firstTimeSetup = true;
} else {
// This is bug fix code of https://github.com/facebook/create-react-app/issues/9868
// Bellow code release variable from non-extensible and freeze status.
appTsConfig.compilerOptions = JSON.parse(JSON.stringify(appTsConfig.compilerOptions));

// Original appTsConfig.compilerOptions status
// Object.isExtensible(appTsConfig.compilerOptions) output: false
// Object.isFrozen(appTsConfig.compilerOptions) output: true
}

for (const option of Object.keys(compilerOptions)) {
Expand Down