diff --git a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts index 471a6d6b6fe..565f58417c8 100644 --- a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts +++ b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts @@ -32,6 +32,7 @@ interface WatchCompilerHostOfConfigFile onCachedDirectoryStructureHostCreate( host: CachedDirectoryStructureHost, ): void; + extraFileExtensions?: readonly ts.FileExtensionInfo[]; } export { WatchCompilerHostOfConfigFile }; diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 682e1d7c731..cf31a5c383d 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -314,6 +314,14 @@ function createWatchProgram( ); oldOnDirectoryStructureHostCreate(host); }; + // This works only on 3.9 + watchCompilerHost.extraFileExtensions = extra.extraFileExtensions.map( + extension => ({ + extension, + isMixedContent: true, + scriptKind: ts.ScriptKind.Deferred, + }), + ); watchCompilerHost.trace = log; // Since we don't want to asynchronously update program we want to disable timeout methods