@@ -2372,9 +2372,9 @@ export function convertToObjectWorker(
2372
2372
}
2373
2373
reportInvalidOptionValue ( option && isString ( option . type ) && option . type !== "string" && ( option . type !== "listOrElement" || ( isString ( option . element . type ) && option . element . type !== "string" ) ) ) ;
2374
2374
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
+ }
2378
2378
if ( option && ! isString ( option . type ) ) {
2379
2379
const customOption = option as CommandLineOptionOfCustomType ;
2380
2380
// Validate custom option type
@@ -2584,16 +2584,6 @@ function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined,
2584
2584
}
2585
2585
2586
2586
function 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
- // }
2597
2587
switch ( optionDefinition . type ) {
2598
2588
case "string" :
2599
2589
case "number" :
@@ -3298,33 +3288,33 @@ function parseOwnConfigOfJsonSourceFile(
3298
3288
switch ( key ) {
3299
3289
case "extends" :
3300
3290
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
+ ) ) ;
3325
3314
}
3326
3315
}
3327
- return ;
3316
+ }
3317
+ return ;
3328
3318
}
3329
3319
} ,
3330
3320
onSetUnknownOptionKeyValueInRoot ( key : string , keyNode : PropertyName , _value : CompilerOptionsValue , _valueNode : Expression ) {
@@ -3399,7 +3389,7 @@ function getExtendedConfig(
3399
3389
resolutionStack : string [ ] ,
3400
3390
errors : Push < Diagnostic > ,
3401
3391
extendedConfigCache : Map < string , ExtendedConfigCacheEntry > | undefined ,
3402
- result : ExtendsResult
3392
+ result : ExtendsResult
3403
3393
) : ParsedTsconfig | undefined {
3404
3394
const path = host . useCaseSensitiveFileNames ? extendedConfigPath : toFileNameLowerCase ( extendedConfigPath ) ;
3405
3395
let value : ExtendedConfigCacheEntry | undefined ;
@@ -3422,10 +3412,10 @@ function getExtendedConfig(
3422
3412
( result . extendedSourceFiles ??= new Set ( ) ) . add ( extendedResult . fileName ) ;
3423
3413
if ( extendedResult . extendedSourceFiles ) {
3424
3414
for ( const extenedSourceFile of extendedResult . extendedSourceFiles ) {
3425
- result . extendedSourceFiles . add ( extenedSourceFile ) ;
3415
+ result . extendedSourceFiles . add ( extenedSourceFile ) ;
3426
3416
}
3427
3417
}
3428
- }
3418
+ }
3429
3419
if ( extendedResult . parseDiagnostics . length ) {
3430
3420
errors . push ( ...extendedResult . parseDiagnostics ) ;
3431
3421
return undefined ;
@@ -3538,7 +3528,7 @@ export function convertJsonOption(opt: CommandLineOption, value: any, basePath:
3538
3528
function normalizeOptionValue ( option : CommandLineOption , basePath : string , value : any ) : CompilerOptionsValue {
3539
3529
if ( isNullOrUndefined ( value ) ) return undefined ;
3540
3530
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" ) {
3542
3532
const listOption = option ;
3543
3533
if ( listOption . element . isFilePath || ! isString ( listOption . element . type ) ) {
3544
3534
return filter ( map ( value , v => normalizeOptionValue ( listOption . element , basePath , v ) ) , v => listOption . listPreserveFalsyValues ? true : ! ! v ) as CompilerOptionsValue ;
0 commit comments