@@ -478,7 +478,7 @@ namespace ts {
478
478
}
479
479
}
480
480
481
- function parseListTypeOption ( opt : CommandLineOptionOfListType , value : string ) : ( number | string ) [ ] {
481
+ function parseListTypeOption ( opt : CommandLineOptionOfListType , value : string ) : ( string | number ) [ ] {
482
482
const values = ( value || "" ) . trim ( ) . split ( "," ) ;
483
483
switch ( opt . element . type ) {
484
484
case "number" :
@@ -590,9 +590,9 @@ namespace ts {
590
590
*/
591
591
export function parseJsonConfigFileContent ( json : any , host : ParseConfigHost , basePath : string , existingOptions : CompilerOptions = { } , configFileName ?: string ) : ParsedCommandLine {
592
592
const errors : Diagnostic [ ] = [ ] ;
593
- const compilerOptions : CompilerOptions = convertCompilerOptionsFromJson ( optionDeclarations , json [ "compilerOptions" ] , basePath , configFileName , errors ) ;
593
+ const compilerOptions : CompilerOptions = convertCompilerOptionsFromJson ( optionDeclarations , json [ "compilerOptions" ] , basePath , errors , configFileName ) ;
594
594
const options = extend ( existingOptions , compilerOptions ) ;
595
- const typingOptions : TypingOptions = convertTypingOptionsFromJson ( typingOptionDeclarations , json [ "typingOptions" ] , basePath , configFileName , errors ) ;
595
+ const typingOptions : TypingOptions = convertTypingOptionsFromJson ( typingOptionDeclarations , json [ "typingOptions" ] , basePath , errors , configFileName ) ;
596
596
597
597
const fileNames = getFileNames ( errors ) ;
598
598
@@ -667,27 +667,27 @@ namespace ts {
667
667
}
668
668
669
669
/* @internal */
670
- export function convertCompilerOptionsFromJson ( optionsDeclarations : CommandLineOption [ ] , jsonOptions : any , basePath : string ,
671
- configFileName : string , errors : Diagnostic [ ] ) : CompilerOptions {
670
+ export function convertCompilerOptionsFromJson ( optionsDeclarations : CommandLineOption [ ] , jsonOptions : any ,
671
+ basePath : string , errors : Diagnostic [ ] , configFileName ?: string ) : CompilerOptions {
672
672
673
673
const options : CompilerOptions = getBaseFileName ( configFileName ) === "jsconfig.json" ? { allowJs : true } : { } ;
674
- convertOptionsFromJson < CompilerOptions > ( optionDeclarations , jsonOptions , basePath , configFileName , options , Diagnostics . Unknown_compiler_option_0 , errors ) ;
674
+ convertOptionsFromJson < CompilerOptions > ( optionDeclarations , jsonOptions , basePath , options , Diagnostics . Unknown_compiler_option_0 , errors ) ;
675
675
return options ;
676
676
}
677
677
678
678
/* @internal */
679
- export function convertTypingOptionsFromJson ( optionsDeclarations : CommandLineOption [ ] , jsonOptions : any , basePath : string ,
680
- configFileName : string , errors : Diagnostic [ ] ) : TypingOptions {
679
+ export function convertTypingOptionsFromJson ( optionsDeclarations : CommandLineOption [ ] , jsonOptions : any ,
680
+ basePath : string , errors : Diagnostic [ ] , configFileName ?: string ) : TypingOptions {
681
681
682
682
const options : TypingOptions = getBaseFileName ( configFileName ) === "jsconfig.json"
683
683
? { enableAutoDiscovery : true , include : [ ] , exclude : [ ] }
684
684
: { enableAutoDiscovery : false , include : [ ] , exclude : [ ] } ;
685
- convertOptionsFromJson < TypingOptions > ( typingOptionDeclarations , jsonOptions , basePath , configFileName , options , Diagnostics . Unknown_typing_option_0 , errors ) ;
685
+ convertOptionsFromJson < TypingOptions > ( typingOptionDeclarations , jsonOptions , basePath , options , Diagnostics . Unknown_typing_option_0 , errors ) ;
686
686
return options ;
687
687
}
688
688
689
689
function convertOptionsFromJson < T extends CompilerOptions | TypingOptions > ( optionDeclarations : CommandLineOption [ ] , jsonOptions : any , basePath : string ,
690
- configFileName : string , defaultOptions : T , diagnosticMessage : DiagnosticMessage , errors : Diagnostic [ ] ) {
690
+ defaultOptions : T , diagnosticMessage : DiagnosticMessage , errors : Diagnostic [ ] ) {
691
691
692
692
if ( ! jsonOptions ) {
693
693
return ;
@@ -706,7 +706,7 @@ namespace ts {
706
706
}
707
707
}
708
708
709
- function convertJsonOption ( opt : CommandLineOption , value : any , basePath : string , errors : Diagnostic [ ] ) : number | string | number [ ] | string [ ] {
709
+ function convertJsonOption ( opt : CommandLineOption , value : any , basePath : string , errors : Diagnostic [ ] ) : CompilerOptionsValue {
710
710
const optType = opt . type ;
711
711
const expectedType = typeof optType === "string" ? optType : "string" ;
712
712
if ( optType === "list" && isArray ( value ) ) {
0 commit comments