File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed 
packages/react-scripts/scripts/utils Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ function verifyTypeScriptSetup() {
103103    } , 
104104  } ; 
105105
106+   const  formatDiagnosticHost  =  { 
107+     getCanonicalFileName : fileName  =>  fileName , 
108+     getCurrentDirectory : ts . sys . getCurrentDirectory , 
109+     getNewLine : ( )  =>  os . EOL , 
110+   } ; 
111+ 
106112  const  messages  =  [ ] ; 
107113  let  appTsConfig ; 
108114  let  parsedTsConfig ; 
@@ -114,7 +120,7 @@ function verifyTypeScriptSetup() {
114120    ) ; 
115121
116122    if  ( error )  { 
117-       throw  error ; 
123+       throw  new   Error ( ts . formatDiagnostic ( error ,   formatDiagnosticHost ) ) ; 
118124    } 
119125
120126    appTsConfig  =  readTsConfig ; 
@@ -132,18 +138,21 @@ function verifyTypeScriptSetup() {
132138    } ) ; 
133139
134140    if  ( result . errors  &&  result . errors . length )  { 
135-       throw  result . errors [ 0 ] ; 
141+       throw  new  Error ( 
142+         ts . formatDiagnostic ( result . errors [ 0 ] ,  formatDiagnosticHost ) 
143+       ) ; 
136144    } 
137145
138146    parsedCompilerOptions  =  result . options ; 
139-   }  catch  ( _ )  { 
147+   }  catch  ( e )  { 
140148    console . error ( 
141149      chalk . red . bold ( 
142150        'Could not parse' , 
143151        chalk . cyan ( 'tsconfig.json' )  +  '.' , 
144152        'Please make sure it contains syntactically correct JSON.' 
145153      ) 
146154    ) ; 
155+     console . error ( e  &&  e . message  ? `Details: ${ e . message }   : '' ) ; 
147156    process . exit ( 1 ) ; 
148157  } 
149158
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments