@@ -1200,15 +1200,7 @@ namespace ts {
1200
1200
/* @internal */
1201
1201
export function generateTSConfig ( options : CompilerOptions , fileNames : ReadonlyArray < string > , newLine : string ) : string {
1202
1202
const compilerOptions = extend ( options , defaultInitCompilerOptions ) ;
1203
- const configurations : { compilerOptions : MapLike < CompilerOptionsValue > ; files ?: ReadonlyArray < string > } = {
1204
- compilerOptions : serializeCompilerOptions ( compilerOptions )
1205
- } ;
1206
- if ( fileNames && fileNames . length ) {
1207
- // only set the files property if we have at least one file
1208
- configurations . files = fileNames ;
1209
- }
1210
-
1211
-
1203
+ const compilerOptionsMap = serializeCompilerOptions ( compilerOptions ) ;
1212
1204
return writeConfigurations ( ) ;
1213
1205
1214
1206
function getCustomTypeMapOfCommandLineOption ( optionDefinition : CommandLineOption ) : Map < string | number > | undefined {
@@ -1306,7 +1298,7 @@ namespace ts {
1306
1298
let seenKnownKeys = 0 ;
1307
1299
const nameColumn : string [ ] = [ ] ;
1308
1300
const descriptionColumn : string [ ] = [ ] ;
1309
- const knownKeysCount = getOwnKeys ( configurations . compilerOptions ) . length ;
1301
+ const knownKeysCount = getOwnKeys ( compilerOptionsMap ) . length ;
1310
1302
for ( const category in categorizedOptions ) {
1311
1303
if ( nameColumn . length !== 0 ) {
1312
1304
nameColumn . push ( "" ) ;
@@ -1316,8 +1308,8 @@ namespace ts {
1316
1308
descriptionColumn . push ( "" ) ;
1317
1309
for ( const option of categorizedOptions [ category ] ) {
1318
1310
let optionName ;
1319
- if ( hasProperty ( configurations . compilerOptions , option . name ) ) {
1320
- optionName = `"${ option . name } ": ${ JSON . stringify ( configurations . compilerOptions [ option . name ] ) } ${ ( seenKnownKeys += 1 ) === knownKeysCount ? "" : "," } ` ;
1311
+ if ( hasProperty ( compilerOptionsMap , option . name ) ) {
1312
+ optionName = `"${ option . name } ": ${ JSON . stringify ( compilerOptionsMap [ option . name ] ) } ${ ( seenKnownKeys += 1 ) === knownKeysCount ? "" : "," } ` ;
1321
1313
}
1322
1314
else {
1323
1315
optionName = `// "${ option . name } ": ${ JSON . stringify ( getDefaultValueForOption ( option ) ) } ,` ;
@@ -1339,11 +1331,11 @@ namespace ts {
1339
1331
const description = descriptionColumn [ i ] ;
1340
1332
result . push ( optionName && `${ tab } ${ tab } ${ optionName } ${ description && ( makePadding ( marginLength - optionName . length + 2 ) + description ) } ` ) ;
1341
1333
}
1342
- if ( configurations . files && configurations . files . length ) {
1334
+ if ( fileNames . length ) {
1343
1335
result . push ( `${ tab } },` ) ;
1344
1336
result . push ( `${ tab } "files": [` ) ;
1345
- for ( let i = 0 ; i < configurations . files . length ; i ++ ) {
1346
- result . push ( `${ tab } ${ tab } ${ JSON . stringify ( configurations . files [ i ] ) } ${ i === configurations . files . length - 1 ? "" : "," } ` ) ;
1337
+ for ( let i = 0 ; i < fileNames . length ; i ++ ) {
1338
+ result . push ( `${ tab } ${ tab } ${ JSON . stringify ( fileNames [ i ] ) } ${ i === fileNames . length - 1 ? "" : "," } ` ) ;
1347
1339
}
1348
1340
result . push ( `${ tab } ]` ) ;
1349
1341
}
0 commit comments