@@ -138,7 +138,7 @@ const jsxOptionMap = new Map(Object.entries({
138
138
} ) ) ;
139
139
140
140
/** @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 ) ) ;
142
142
143
143
// NOTE: The order here is important to default lib ordering as entries will have the same
144
144
// order in the generated program (see `getDefaultLibPriority` in program.ts). This
@@ -248,15 +248,15 @@ const libEntries: [string, string][] = [
248
248
*
249
249
* @internal
250
250
*/
251
- export const libs = libEntries . map ( entry => entry [ 0 ] ) ;
251
+ export const libs : string [ ] = libEntries . map ( entry => entry [ 0 ] ) ;
252
252
253
253
/**
254
254
* A map of lib names to lib files. This map is used both for parsing the "lib" command line
255
255
* option as well as for resolving lib reference directives.
256
256
*
257
257
* @internal
258
258
*/
259
- export const libMap = new Map ( libEntries ) ;
259
+ export const libMap : Map < string , string > = new Map ( libEntries ) ;
260
260
261
261
// Watch related options
262
262
@@ -1800,7 +1800,7 @@ function createDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType
1800
1800
}
1801
1801
1802
1802
/** @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 {
1804
1804
return convertJsonOptionOfCustomType ( opt , ( value ?? "" ) . trim ( ) , errors ) ;
1805
1805
}
1806
1806
@@ -1835,6 +1835,14 @@ export interface OptionsBase {
1835
1835
[ option : string ] : CompilerOptionsValue | TsConfigSourceFile | undefined ;
1836
1836
}
1837
1837
1838
+ /** @internal */
1839
+ export interface BaseParsedCommandLine {
1840
+ options : OptionsBase ;
1841
+ watchOptions : WatchOptions | undefined ;
1842
+ fileNames : string [ ] ;
1843
+ errors : Diagnostic [ ] ;
1844
+ }
1845
+
1838
1846
/** @internal */
1839
1847
export interface ParseCommandLineWorkerDiagnostics extends DidYouMeanOptionsDiagnostics {
1840
1848
getOptionsNameMap : ( ) => OptionsNameMap ;
@@ -1875,7 +1883,7 @@ export function parseCommandLineWorker(
1875
1883
diagnostics : ParseCommandLineWorkerDiagnostics ,
1876
1884
commandLine : readonly string [ ] ,
1877
1885
readFile ?: ( path : string ) => string | undefined ,
1878
- ) {
1886
+ ) : BaseParsedCommandLine {
1879
1887
const options = { } as OptionsBase ;
1880
1888
let watchOptions : WatchOptions | undefined ;
1881
1889
const fileNames : string [ ] = [ ] ;
@@ -2602,11 +2610,11 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
2602
2610
const providedKeys = new Set ( optionMap . keys ( ) ) ;
2603
2611
const impliedCompilerOptions : Record < string , CompilerOptionsValue > = { } ;
2604
2612
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 ( { } ) ;
2608
2616
if ( implied !== defaultValue ) {
2609
- impliedCompilerOptions [ option ] = computedOptions [ option as keyof typeof computedOptions ] . computeValue ( configParseResult . options ) ;
2617
+ impliedCompilerOptions [ option ] = computedOptions [ option ] . computeValue ( configParseResult . options ) ;
2610
2618
}
2611
2619
}
2612
2620
}
@@ -2866,7 +2874,7 @@ export function generateTSConfig(options: CompilerOptions, fileNames: readonly s
2866
2874
}
2867
2875
2868
2876
/** @internal */
2869
- export function convertToOptionsWithAbsolutePaths ( options : CompilerOptions , toAbsolutePath : ( path : string ) => string ) {
2877
+ export function convertToOptionsWithAbsolutePaths ( options : CompilerOptions , toAbsolutePath : ( path : string ) => string ) : CompilerOptions {
2870
2878
const result : CompilerOptions = { } ;
2871
2879
const optionsNameMap = getOptionsNameMap ( ) . optionsNameMap ;
2872
2880
@@ -2927,7 +2935,7 @@ export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceF
2927
2935
}
2928
2936
2929
2937
/** @internal */
2930
- export function setConfigFileInOptions ( options : CompilerOptions , configFile : TsConfigSourceFile | undefined ) {
2938
+ export function setConfigFileInOptions ( options : CompilerOptions , configFile : TsConfigSourceFile | undefined ) : void {
2931
2939
if ( configFile ) {
2932
2940
Object . defineProperty ( options , "configFile" , { enumerable : false , writable : false , value : configFile } ) ;
2933
2941
}
@@ -3243,12 +3251,12 @@ function shouldReportNoInputFiles(fileNames: string[], canJsonReportNoInutFiles:
3243
3251
}
3244
3252
3245
3253
/** @internal */
3246
- export function canJsonReportNoInputFiles ( raw : any ) {
3254
+ export function canJsonReportNoInputFiles ( raw : any ) : boolean {
3247
3255
return ! hasProperty ( raw , "files" ) && ! hasProperty ( raw , "references" ) ;
3248
3256
}
3249
3257
3250
3258
/** @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 {
3252
3260
const existingErrors = configParseDiagnostics . length ;
3253
3261
if ( shouldReportNoInputFiles ( fileNames , canJsonReportNoInutFiles ) ) {
3254
3262
configParseDiagnostics . push ( getErrorForNoInputFiles ( configFileSpecs , configFileName ) ) ;
@@ -3943,7 +3951,7 @@ export function matchesExclude(
3943
3951
excludeSpecs : readonly string [ ] | undefined ,
3944
3952
useCaseSensitiveFileNames : boolean ,
3945
3953
currentDirectory : string ,
3946
- ) {
3954
+ ) : boolean {
3947
3955
return matchesExcludeWorker (
3948
3956
pathToCheck ,
3949
3957
filter ( excludeSpecs , spec => ! invalidDotDotAfterRecursiveWildcard ( spec ) ) ,
0 commit comments