@@ -2372,9 +2372,9 @@ export function convertToObjectWorker(
23722372 }
23732373 reportInvalidOptionValue ( option && isString ( option . type ) && option . type !== "string" && ( option . type !== "listOrElement" || ( isString ( option . element . type ) && option . element . type !== "string" ) ) ) ;
23742374 const text = ( valueExpression as StringLiteral ) . text ;
2375- if ( option ) {
2376- Debug . assert ( option . type !== "listOrElement" || option . element . type === "string" , "Only string or array of string is handled for now" ) ;
2377- }
2375+ if ( option ) {
2376+ Debug . assert ( option . type !== "listOrElement" || option . element . type === "string" , "Only string or array of string is handled for now" ) ;
2377+ }
23782378 if ( option && ! isString ( option . type ) ) {
23792379 const customOption = option as CommandLineOptionOfCustomType ;
23802380 // Validate custom option type
@@ -2584,16 +2584,6 @@ function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined,
25842584}
25852585
25862586function getCustomTypeMapOfCommandLineOption ( optionDefinition : CommandLineOption ) : Map < string , string | number > | undefined {
2587- // if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean" || optionDefinition.type === "object") {
2588- // // this is of a type CommandLineOptionOfPrimitiveType
2589- // return undefined;
2590- // }
2591- // else if (optionDefinition.type === "list" || optionDefinition.type === "listOrElement") {
2592- // return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
2593- // }
2594- // else {
2595- // return optionDefinition.type;
2596- // }
25972587 switch ( optionDefinition . type ) {
25982588 case "string" :
25992589 case "number" :
@@ -3298,33 +3288,33 @@ function parseOwnConfigOfJsonSourceFile(
32983288 switch ( key ) {
32993289 case "extends" :
33003290 const newBase = configFileName ? directoryOfCombinedPath ( configFileName , basePath ) : basePath ;
3301- if ( isString ( value ) ) {
3302- extendedConfigPath = getExtendsConfigPath (
3303- value ,
3304- host ,
3305- newBase ,
3306- errors ,
3307- ( message , arg0 ) =>
3308- createDiagnosticForNodeInSourceFile ( sourceFile , valueNode , message , arg0 )
3309- ) ;
3310- }
3311- else {
3312- extendedConfigPath = [ ] ;
3313- for ( let index = 0 ; index < ( value as unknown [ ] ) . length ; index ++ ) {
3314- const fileName = ( value as unknown [ ] ) [ index ] ;
3315- if ( isString ( fileName ) ) {
3316- extendedConfigPath = append ( extendedConfigPath , getExtendsConfigPath (
3317- fileName ,
3318- host ,
3319- newBase ,
3320- errors ,
3321- ( message , arg0 ) =>
3322- createDiagnosticForNodeInSourceFile ( sourceFile , ( valueNode as ArrayLiteralExpression ) . elements [ index ] , message , arg0 )
3323- ) ) ;
3324- }
3291+ if ( isString ( value ) ) {
3292+ extendedConfigPath = getExtendsConfigPath (
3293+ value ,
3294+ host ,
3295+ newBase ,
3296+ errors ,
3297+ ( message , arg0 ) =>
3298+ createDiagnosticForNodeInSourceFile ( sourceFile , valueNode , message , arg0 )
3299+ ) ;
3300+ }
3301+ else {
3302+ extendedConfigPath = [ ] ;
3303+ for ( let index = 0 ; index < ( value as unknown [ ] ) . length ; index ++ ) {
3304+ const fileName = ( value as unknown [ ] ) [ index ] ;
3305+ if ( isString ( fileName ) ) {
3306+ extendedConfigPath = append ( extendedConfigPath , getExtendsConfigPath (
3307+ fileName ,
3308+ host ,
3309+ newBase ,
3310+ errors ,
3311+ ( message , arg0 ) =>
3312+ createDiagnosticForNodeInSourceFile ( sourceFile , ( valueNode as ArrayLiteralExpression ) . elements [ index ] , message , arg0 )
3313+ ) ) ;
33253314 }
33263315 }
3327- return ;
3316+ }
3317+ return ;
33283318 }
33293319 } ,
33303320 onSetUnknownOptionKeyValueInRoot ( key : string , keyNode : PropertyName , _value : CompilerOptionsValue , _valueNode : Expression ) {
@@ -3399,7 +3389,7 @@ function getExtendedConfig(
33993389 resolutionStack : string [ ] ,
34003390 errors : Push < Diagnostic > ,
34013391 extendedConfigCache : Map < string , ExtendedConfigCacheEntry > | undefined ,
3402- result : ExtendsResult
3392+ result : ExtendsResult
34033393) : ParsedTsconfig | undefined {
34043394 const path = host . useCaseSensitiveFileNames ? extendedConfigPath : toFileNameLowerCase ( extendedConfigPath ) ;
34053395 let value : ExtendedConfigCacheEntry | undefined ;
@@ -3422,10 +3412,10 @@ function getExtendedConfig(
34223412 ( result . extendedSourceFiles ??= new Set ( ) ) . add ( extendedResult . fileName ) ;
34233413 if ( extendedResult . extendedSourceFiles ) {
34243414 for ( const extenedSourceFile of extendedResult . extendedSourceFiles ) {
3425- result . extendedSourceFiles . add ( extenedSourceFile ) ;
3415+ result . extendedSourceFiles . add ( extenedSourceFile ) ;
34263416 }
34273417 }
3428- }
3418+ }
34293419 if ( extendedResult . parseDiagnostics . length ) {
34303420 errors . push ( ...extendedResult . parseDiagnostics ) ;
34313421 return undefined ;
@@ -3538,7 +3528,7 @@ export function convertJsonOption(opt: CommandLineOption, value: any, basePath:
35383528function normalizeOptionValue ( option : CommandLineOption , basePath : string , value : any ) : CompilerOptionsValue {
35393529 if ( isNullOrUndefined ( value ) ) return undefined ;
35403530 if ( option . type === "listOrElement" && ! isArray ( value ) ) return normalizeOptionValue ( option . element , basePath , value ) ;
3541- else if ( option . type === "list" || option . type === "listOrElement" ) {
3531+ else if ( option . type === "list" || option . type === "listOrElement" ) {
35423532 const listOption = option ;
35433533 if ( listOption . element . isFilePath || ! isString ( listOption . element . type ) ) {
35443534 return filter ( map ( value , v => normalizeOptionValue ( listOption . element , basePath , v ) ) , v => listOption . listPreserveFalsyValues ? true : ! ! v ) as CompilerOptionsValue ;
0 commit comments