@@ -149,6 +149,8 @@ namespace ts {
149149
150150 watchOptionsToExtend ?: WatchOptions ;
151151
152+ extraFileExtensions ?: readonly FileExtensionInfo [ ]
153+
152154 /**
153155 * Used to generate source file names from the config file and its include, exclude, files rules
154156 * and also to cache the directory stucture
@@ -191,14 +193,32 @@ namespace ts {
191193 /**
192194 * Create the watch compiler host for either configFile or fileNames and its options
193195 */
194- export function createWatchCompilerHost < T extends BuilderProgram > ( configFileName : string , optionsToExtend : CompilerOptions | undefined , system : System , createProgram ?: CreateProgram < T > , reportDiagnostic ?: DiagnosticReporter , reportWatchStatus ?: WatchStatusReporter , watchOptionsToExtend ?: WatchOptions ) : WatchCompilerHostOfConfigFile < T > ;
196+ export function createWatchCompilerHost < T extends BuilderProgram > ( configFileName : string , optionsToExtend : CompilerOptions | undefined , system : System , createProgram ?: CreateProgram < T > , reportDiagnostic ?: DiagnosticReporter , reportWatchStatus ?: WatchStatusReporter , watchOptionsToExtend ?: WatchOptions , extraFileExtensions ?: readonly FileExtensionInfo [ ] ) : WatchCompilerHostOfConfigFile < T > ;
195197 export function createWatchCompilerHost < T extends BuilderProgram > ( rootFiles : string [ ] , options : CompilerOptions , system : System , createProgram ?: CreateProgram < T > , reportDiagnostic ?: DiagnosticReporter , reportWatchStatus ?: WatchStatusReporter , projectReferences ?: readonly ProjectReference [ ] , watchOptions ?: WatchOptions ) : WatchCompilerHostOfFilesAndCompilerOptions < T > ;
196- export function createWatchCompilerHost < T extends BuilderProgram > ( rootFilesOrConfigFileName : string | string [ ] , options : CompilerOptions | undefined , system : System , createProgram ?: CreateProgram < T > , reportDiagnostic ?: DiagnosticReporter , reportWatchStatus ?: WatchStatusReporter , projectReferencesOrWatchOptionsToExtend ?: readonly ProjectReference [ ] | WatchOptions , watchOptions ?: WatchOptions ) : WatchCompilerHostOfFilesAndCompilerOptions < T > | WatchCompilerHostOfConfigFile < T > {
198+ export function createWatchCompilerHost < T extends BuilderProgram > ( rootFilesOrConfigFileName : string | string [ ] , options : CompilerOptions | undefined , system : System , createProgram ?: CreateProgram < T > , reportDiagnostic ?: DiagnosticReporter , reportWatchStatus ?: WatchStatusReporter , projectReferencesOrWatchOptionsToExtend ?: readonly ProjectReference [ ] | WatchOptions , watchOptionsOrExtraFileExtensions ?: WatchOptions | readonly FileExtensionInfo [ ] ) : WatchCompilerHostOfFilesAndCompilerOptions < T > | WatchCompilerHostOfConfigFile < T > {
197199 if ( isArray ( rootFilesOrConfigFileName ) ) {
198- return createWatchCompilerHostOfFilesAndCompilerOptions ( rootFilesOrConfigFileName , options ! , watchOptions , system , createProgram , reportDiagnostic , reportWatchStatus , projectReferencesOrWatchOptionsToExtend as readonly ProjectReference [ ] ) ; // TODO: GH#18217
200+ return createWatchCompilerHostOfFilesAndCompilerOptions ( {
201+ rootFiles : rootFilesOrConfigFileName ,
202+ options : options ! ,
203+ watchOptions : watchOptionsOrExtraFileExtensions as WatchOptions ,
204+ projectReferences : projectReferencesOrWatchOptionsToExtend as readonly ProjectReference [ ] ,
205+ system,
206+ createProgram,
207+ reportDiagnostic,
208+ reportWatchStatus,
209+ } ) ;
199210 }
200211 else {
201- return createWatchCompilerHostOfConfigFile ( rootFilesOrConfigFileName , options , projectReferencesOrWatchOptionsToExtend as WatchOptions , system , createProgram , reportDiagnostic , reportWatchStatus ) ;
212+ return createWatchCompilerHostOfConfigFile ( {
213+ configFileName : rootFilesOrConfigFileName ,
214+ optionsToExtend : options ,
215+ watchOptionsToExtend : projectReferencesOrWatchOptionsToExtend as WatchOptions ,
216+ extraFileExtensions : watchOptionsOrExtraFileExtensions as readonly FileExtensionInfo [ ] ,
217+ system,
218+ createProgram,
219+ reportDiagnostic,
220+ reportWatchStatus,
221+ } ) ;
202222 }
203223 }
204224
@@ -237,7 +257,7 @@ namespace ts {
237257
238258 const useCaseSensitiveFileNames = host . useCaseSensitiveFileNames ( ) ;
239259 const currentDirectory = host . getCurrentDirectory ( ) ;
240- const { configFileName, optionsToExtend : optionsToExtendForConfigFile = { } , watchOptionsToExtend, createProgram } = host ;
260+ const { configFileName, optionsToExtend : optionsToExtendForConfigFile = { } , watchOptionsToExtend, extraFileExtensions , createProgram } = host ;
241261 let { rootFiles : rootFileNames , options : compilerOptions , watchOptions, projectReferences } = host ;
242262 let configFileSpecs : ConfigFileSpecs ;
243263 let configFileParsingDiagnostics : Diagnostic [ ] | undefined ;
@@ -614,7 +634,7 @@ namespace ts {
614634 }
615635
616636 function parseConfigFile ( ) {
617- setConfigFileParsingResult ( getParsedCommandLineOfConfigFile ( configFileName , optionsToExtendForConfigFile , parseConfigFileHost , /*extendedConfigCache*/ undefined , watchOptionsToExtend ) ! ) ; // TODO: GH#18217
637+ setConfigFileParsingResult ( getParsedCommandLineOfConfigFile ( configFileName , optionsToExtendForConfigFile , parseConfigFileHost , /*extendedConfigCache*/ undefined , watchOptionsToExtend , extraFileExtensions ) ! ) ; // TODO: GH#18217
618638 }
619639
620640 function setConfigFileParsingResult ( configFileParseResult : ParsedCommandLine ) {
0 commit comments