@@ -19,6 +19,24 @@ function writeJson(fileName, object) {
19
19
fs . writeFileSync ( fileName , JSON . stringify ( object , null , 2 ) + os . EOL ) ;
20
20
}
21
21
22
+ const compilerOptions = {
23
+ // These are suggested values and will be set when not present in the
24
+ // tsconfig.json
25
+ target : { suggested : 'es5' } ,
26
+ allowJs : { suggested : true } ,
27
+ skipLibCheck : { suggested : true } ,
28
+ esModuleInterop : { suggested : true } ,
29
+ allowSyntheticDefaultImports : { suggested : true } ,
30
+ strict : { suggested : true } ,
31
+
32
+ // This values are required and cannot be changed by the user
33
+ module : { value : 'esnext' , reason : 'for import() and import/export' } ,
34
+ moduleResolution : { value : 'node' , reason : 'to match webpack resolution' } ,
35
+ isolatedModules : { value : true , reason : 'implementation limitation' } ,
36
+ noEmit : { value : true } ,
37
+ jsx : { value : 'preserve' , reason : 'JSX is compiled by Babel' } ,
38
+ } ;
39
+
22
40
function verifyTypeScriptSetup ( ) {
23
41
if ( ! fs . existsSync ( paths . appTsConfig ) ) {
24
42
if ( ! paths . appIndexJs . match ( / \. t s ? $ / ) ) {
@@ -82,23 +100,6 @@ function verifyTypeScriptSetup() {
82
100
tsconfig . compilerOptions = { } ;
83
101
}
84
102
85
- const compilerOptions = {
86
- target : { suggested : 'es5' } ,
87
- allowJs : { suggested : true } ,
88
- skipLibCheck : { suggested : true } ,
89
- module : { value : 'esnext' , reason : 'for import() and import/export' } ,
90
- moduleResolution : { value : 'node' , reason : 'to match webpack resolution' } ,
91
- isolatedModules : { value : true , reason : 'implementation limitation' } ,
92
- noEmit : { value : true } ,
93
- jsx : { value : 'preserve' , reason : 'JSX is compiled by Babel' } ,
94
- esModuleInterop : { value : true , reason : 'Babel compatibility' } ,
95
- allowSyntheticDefaultImports : {
96
- value : true ,
97
- reason : 'Babel compatibility' ,
98
- } ,
99
- strict : { suggested : true } ,
100
- } ;
101
-
102
103
for ( const option of Object . keys ( compilerOptions ) ) {
103
104
const { value, suggested, reason } = compilerOptions [ option ] ;
104
105
if ( suggested != null ) {
0 commit comments