1
1
import {
2
+ addToSeen ,
2
3
AlternateModeDiagnostics ,
3
4
append ,
4
5
arrayFrom ,
@@ -2629,7 +2630,7 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
2629
2630
const providedKeys = new Set ( optionMap . keys ( ) ) ;
2630
2631
const impliedCompilerOptions : Record < string , CompilerOptionsValue > = { } ;
2631
2632
for ( const option in computedOptions ) {
2632
- if ( ! providedKeys . has ( option ) && some ( computedOptions [ option ] . dependencies , dep => providedKeys . has ( dep ) ) ) {
2633
+ if ( ! providedKeys . has ( option ) && optionDependsOn ( option , providedKeys ) ) {
2633
2634
const implied = computedOptions [ option ] . computeValue ( configParseResult . options ) ;
2634
2635
const defaultValue = computedOptions [ option ] . computeValue ( { } ) ;
2635
2636
if ( implied !== defaultValue ) {
@@ -2641,6 +2642,18 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
2641
2642
return config ;
2642
2643
}
2643
2644
2645
+ function optionDependsOn ( option : string , dependsOn : Set < string > ) : boolean {
2646
+ const seen = new Set < string > ( ) ;
2647
+ return optionDependsOnRecursive ( option ) ;
2648
+
2649
+ function optionDependsOnRecursive ( option : string ) : boolean {
2650
+ if ( addToSeen ( seen , option ) ) {
2651
+ return some ( computedOptions [ option ] ?. dependencies , dep => dependsOn . has ( dep ) || optionDependsOnRecursive ( dep ) ) ;
2652
+ }
2653
+ return false ;
2654
+ }
2655
+ }
2656
+
2644
2657
/** @internal */
2645
2658
export function optionMapToObject ( optionMap : Map < string , CompilerOptionsValue > ) : object {
2646
2659
return Object . fromEntries ( optionMap ) ;
0 commit comments