@@ -218,15 +218,7 @@ function verifyTypeScriptSetup() {
218
218
if ( appTsConfig . compilerOptions == null ) {
219
219
appTsConfig . compilerOptions = { } ;
220
220
firstTimeSetup = true ;
221
- } else {
222
- // This is bug fix code of https://github.com/facebook/create-react-app/issues/9868
223
- // Bellow code release variable from non-extensible and freeze status.
224
- appTsConfig . compilerOptions = JSON . parse ( JSON . stringify ( appTsConfig . compilerOptions ) ) ;
225
-
226
- // Original appTsConfig.compilerOptions status
227
- // Object.isExtensible(appTsConfig.compilerOptions) output: false
228
- // Object.isFrozen(appTsConfig.compilerOptions) output: true
229
- }
221
+ }
230
222
231
223
for ( const option of Object . keys ( compilerOptions ) ) {
232
224
const { parsedValue, value, suggested, reason } = compilerOptions [ option ] ;
@@ -236,15 +228,19 @@ function verifyTypeScriptSetup() {
236
228
237
229
if ( suggested != null ) {
238
230
if ( parsedCompilerOptions [ option ] === undefined ) {
239
- appTsConfig . compilerOptions [ option ] = suggested ;
231
+ appTsConfig = immer ( appTsConfig , config => {
232
+ config . compilerOptions [ option ] = suggested ;
233
+ } ) ;
240
234
messages . push (
241
235
`${ coloredOption } to be ${ chalk . bold (
242
236
'suggested'
243
237
) } value: ${ chalk . cyan . bold ( suggested ) } (this can be changed)`
244
238
) ;
245
239
}
246
240
} else if ( parsedCompilerOptions [ option ] !== valueToCheck ) {
247
- appTsConfig . compilerOptions [ option ] = value ;
241
+ appTsConfig = immer ( appTsConfig , config => {
242
+ config . compilerOptions [ option ] = value ;
243
+ } ) ;
248
244
messages . push (
249
245
`${ coloredOption } ${ chalk . bold (
250
246
valueToCheck == null ? 'must not' : 'must'
@@ -256,7 +252,9 @@ function verifyTypeScriptSetup() {
256
252
257
253
// tsconfig will have the merged "include" and "exclude" by this point
258
254
if ( parsedTsConfig . include == null ) {
259
- appTsConfig . include = [ 'src' ] ;
255
+ appTsConfig = immer ( appTsConfig , config => {
256
+ config . include = [ 'src' ] ;
257
+ } ) ;
260
258
messages . push (
261
259
`${ chalk . cyan ( 'include' ) } should be ${ chalk . cyan . bold ( 'src' ) } `
262
260
) ;
0 commit comments