@@ -15,6 +15,7 @@ import {
1515 CommandLineOptionOfListType ,
1616 CompilerOptions ,
1717 CompilerOptionsValue ,
18+ computedOptions ,
1819 ConfigFileSpecs ,
1920 containsPath ,
2021 convertToRelativePath ,
@@ -103,6 +104,7 @@ import {
103104 removeTrailingDirectorySeparator ,
104105 returnTrue ,
105106 ScriptTarget ,
107+ some ,
106108 startsWith ,
107109 StringLiteral ,
108110 SyntaxKind ,
@@ -2475,9 +2477,10 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
24752477 ) ,
24762478 f => getRelativePathFromFile ( getNormalizedAbsolutePath ( configFileName , host . getCurrentDirectory ( ) ) , getNormalizedAbsolutePath ( f , host . getCurrentDirectory ( ) ) , getCanonicalFileName ) ,
24772479 ) ;
2478- const optionMap = serializeCompilerOptions ( configParseResult . options , { configFilePath : getNormalizedAbsolutePath ( configFileName , host . getCurrentDirectory ( ) ) , useCaseSensitiveFileNames : host . useCaseSensitiveFileNames } ) ;
2480+ const pathOptions = { configFilePath : getNormalizedAbsolutePath ( configFileName , host . getCurrentDirectory ( ) ) , useCaseSensitiveFileNames : host . useCaseSensitiveFileNames } ;
2481+ const optionMap = serializeCompilerOptions ( configParseResult . options , pathOptions ) ;
24792482 const watchOptionMap = configParseResult . watchOptions && serializeWatchOptions ( configParseResult . watchOptions ) ;
2480- const config = {
2483+ const config : TSConfig & { watchOptions ?: object ; } = {
24812484 compilerOptions : {
24822485 ...optionMapToObject ( optionMap ) ,
24832486 showConfig : undefined ,
@@ -2500,6 +2503,19 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
25002503 } : { } ) ,
25012504 compileOnSave : ! ! configParseResult . compileOnSave ? true : undefined ,
25022505 } ;
2506+
2507+ const providedKeys = new Set ( optionMap . keys ( ) ) ;
2508+ const impliedCompilerOptions : Record < string , CompilerOptionsValue > = { } ;
2509+ for ( const option in computedOptions ) {
2510+ if ( ! providedKeys . has ( option ) && some ( computedOptions [ option as keyof typeof computedOptions ] . dependencies , dep => providedKeys . has ( dep ) ) ) {
2511+ const implied = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( configParseResult . options ) ;
2512+ const defaultValue = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( { } ) ;
2513+ if ( implied !== defaultValue ) {
2514+ impliedCompilerOptions [ option ] = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( configParseResult . options ) ;
2515+ }
2516+ }
2517+ }
2518+ assign ( config . compilerOptions , optionMapToObject ( serializeCompilerOptions ( impliedCompilerOptions , pathOptions ) ) ) ;
25032519 return config ;
25042520}
25052521
0 commit comments