@@ -138,7 +138,7 @@ const jsxOptionMap = new Map(Object.entries({
138138} ) ) ;
139139
140140/** @internal */
141- export const inverseJsxOptionMap = new Map ( mapIterator ( jsxOptionMap . entries ( ) , ( [ key , value ] : [ string , JsxEmit ] ) => [ "" + value , key ] as const ) ) ;
141+ export const inverseJsxOptionMap : Map < string , string > = new Map ( mapIterator ( jsxOptionMap . entries ( ) , ( [ key , value ] : [ string , JsxEmit ] ) => [ "" + value , key ] as const ) ) ;
142142
143143// NOTE: The order here is important to default lib ordering as entries will have the same
144144// order in the generated program (see `getDefaultLibPriority` in program.ts). This
@@ -248,15 +248,15 @@ const libEntries: [string, string][] = [
248248 *
249249 * @internal
250250 */
251- export const libs = libEntries . map ( entry => entry [ 0 ] ) ;
251+ export const libs : string [ ] = libEntries . map ( entry => entry [ 0 ] ) ;
252252
253253/**
254254 * A map of lib names to lib files. This map is used both for parsing the "lib" command line
255255 * option as well as for resolving lib reference directives.
256256 *
257257 * @internal
258258 */
259- export const libMap = new Map ( libEntries ) ;
259+ export const libMap : Map < string , string > = new Map ( libEntries ) ;
260260
261261// Watch related options
262262
@@ -1800,7 +1800,7 @@ function createDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType
18001800}
18011801
18021802/** @internal */
1803- export function parseCustomTypeOption ( opt : CommandLineOptionOfCustomType , value : string | undefined , errors : Diagnostic [ ] ) {
1803+ export function parseCustomTypeOption ( opt : CommandLineOptionOfCustomType , value : string | undefined , errors : Diagnostic [ ] ) : string | number | undefined {
18041804 return convertJsonOptionOfCustomType ( opt , ( value ?? "" ) . trim ( ) , errors ) ;
18051805}
18061806
@@ -1835,6 +1835,14 @@ export interface OptionsBase {
18351835 [ option : string ] : CompilerOptionsValue | TsConfigSourceFile | undefined ;
18361836}
18371837
1838+ /** @internal */
1839+ export interface BaseParsedCommandLine {
1840+ options : OptionsBase ;
1841+ watchOptions : WatchOptions | undefined ;
1842+ fileNames : string [ ] ;
1843+ errors : Diagnostic [ ] ;
1844+ }
1845+
18381846/** @internal */
18391847export interface ParseCommandLineWorkerDiagnostics extends DidYouMeanOptionsDiagnostics {
18401848 getOptionsNameMap : ( ) => OptionsNameMap ;
@@ -1875,7 +1883,7 @@ export function parseCommandLineWorker(
18751883 diagnostics : ParseCommandLineWorkerDiagnostics ,
18761884 commandLine : readonly string [ ] ,
18771885 readFile ?: ( path : string ) => string | undefined ,
1878- ) {
1886+ ) : BaseParsedCommandLine {
18791887 const options = { } as OptionsBase ;
18801888 let watchOptions : WatchOptions | undefined ;
18811889 const fileNames : string [ ] = [ ] ;
@@ -2602,11 +2610,11 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
26022610 const providedKeys = new Set ( optionMap . keys ( ) ) ;
26032611 const impliedCompilerOptions : Record < string , CompilerOptionsValue > = { } ;
26042612 for ( const option in computedOptions ) {
2605- if ( ! providedKeys . has ( option ) && some ( computedOptions [ option as keyof typeof computedOptions ] . dependencies , dep => providedKeys . has ( dep ) ) ) {
2606- const implied = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( configParseResult . options ) ;
2607- const defaultValue = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( { } ) ;
2613+ if ( ! providedKeys . has ( option ) && some ( computedOptions [ option ] . dependencies , dep => providedKeys . has ( dep ) ) ) {
2614+ const implied = computedOptions [ option ] . computeValue ( configParseResult . options ) ;
2615+ const defaultValue = computedOptions [ option ] . computeValue ( { } ) ;
26082616 if ( implied !== defaultValue ) {
2609- impliedCompilerOptions [ option ] = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( configParseResult . options ) ;
2617+ impliedCompilerOptions [ option ] = computedOptions [ option ] . computeValue ( configParseResult . options ) ;
26102618 }
26112619 }
26122620 }
@@ -2866,7 +2874,7 @@ export function generateTSConfig(options: CompilerOptions, fileNames: readonly s
28662874}
28672875
28682876/** @internal */
2869- export function convertToOptionsWithAbsolutePaths ( options : CompilerOptions , toAbsolutePath : ( path : string ) => string ) {
2877+ export function convertToOptionsWithAbsolutePaths ( options : CompilerOptions , toAbsolutePath : ( path : string ) => string ) : CompilerOptions {
28702878 const result : CompilerOptions = { } ;
28712879 const optionsNameMap = getOptionsNameMap ( ) . optionsNameMap ;
28722880
@@ -2927,7 +2935,7 @@ export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceF
29272935}
29282936
29292937/** @internal */
2930- export function setConfigFileInOptions ( options : CompilerOptions , configFile : TsConfigSourceFile | undefined ) {
2938+ export function setConfigFileInOptions ( options : CompilerOptions , configFile : TsConfigSourceFile | undefined ) : void {
29312939 if ( configFile ) {
29322940 Object . defineProperty ( options , "configFile" , { enumerable : false , writable : false , value : configFile } ) ;
29332941 }
@@ -3243,12 +3251,12 @@ function shouldReportNoInputFiles(fileNames: string[], canJsonReportNoInutFiles:
32433251}
32443252
32453253/** @internal */
3246- export function canJsonReportNoInputFiles ( raw : any ) {
3254+ export function canJsonReportNoInputFiles ( raw : any ) : boolean {
32473255 return ! hasProperty ( raw , "files" ) && ! hasProperty ( raw , "references" ) ;
32483256}
32493257
32503258/** @internal */
3251- export function updateErrorForNoInputFiles ( fileNames : string [ ] , configFileName : string , configFileSpecs : ConfigFileSpecs , configParseDiagnostics : Diagnostic [ ] , canJsonReportNoInutFiles : boolean ) {
3259+ export function updateErrorForNoInputFiles ( fileNames : string [ ] , configFileName : string , configFileSpecs : ConfigFileSpecs , configParseDiagnostics : Diagnostic [ ] , canJsonReportNoInutFiles : boolean ) : boolean {
32523260 const existingErrors = configParseDiagnostics . length ;
32533261 if ( shouldReportNoInputFiles ( fileNames , canJsonReportNoInutFiles ) ) {
32543262 configParseDiagnostics . push ( getErrorForNoInputFiles ( configFileSpecs , configFileName ) ) ;
@@ -3943,7 +3951,7 @@ export function matchesExclude(
39433951 excludeSpecs : readonly string [ ] | undefined ,
39443952 useCaseSensitiveFileNames : boolean ,
39453953 currentDirectory : string ,
3946- ) {
3954+ ) : boolean {
39473955 return matchesExcludeWorker (
39483956 pathToCheck ,
39493957 filter ( excludeSpecs , spec => ! invalidDotDotAfterRecursiveWildcard ( spec ) ) ,
0 commit comments