Skip to content

Commit

Permalink
fix: use Abstract Builder instead of semantic builder
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Mar 10, 2020
1 parent 0b0760c commit 2405fae
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -18,7 +18,7 @@ const log = debug('typescript-eslint:typescript-estree:createWatchProgram');
*/
const knownWatchProgramMap = new Map<
CanonicalPath,
ts.WatchOfConfigFile<ts.SemanticDiagnosticsBuilderProgram>
ts.WatchOfConfigFile<ts.BuilderProgram>
>();

/**
Expand Down Expand Up @@ -229,18 +229,18 @@ function getProgramsForProjects(
function createWatchProgram(
tsconfigPath: string,
extra: Extra,
): ts.WatchOfConfigFile<ts.SemanticDiagnosticsBuilderProgram> {
): ts.WatchOfConfigFile<ts.BuilderProgram> {
log('Creating watch program for %s.', tsconfigPath);

// create compiler host
const watchCompilerHost = ts.createWatchCompilerHost(
tsconfigPath,
createDefaultCompilerOptionsFromExtra(extra),
ts.sys,
ts.createSemanticDiagnosticsBuilderProgram,
ts.createAbstractBuilder,
diagnosticReporter,
/*reportWatchStatus*/ () => {},
) as WatchCompilerHostOfConfigFile<ts.SemanticDiagnosticsBuilderProgram>;
) as WatchCompilerHostOfConfigFile<ts.BuilderProgram>;

// ensure readFile reads the code being linted instead of the copy on disk
const oldReadFile = watchCompilerHost.readFile;
Expand Down Expand Up @@ -325,7 +325,7 @@ function createWatchProgram(
};
const watch = ts.createWatchProgram(watchCompilerHost);
const originalGetProgram = watch.getProgram;
watch.getProgram = (): ts.SemanticDiagnosticsBuilderProgram => {
watch.getProgram = (): ts.BuilderProgram => {
if (callback) {
callback();
}
Expand All @@ -352,7 +352,7 @@ function hasTSConfigChanged(tsconfigPath: CanonicalPath): boolean {
}

function maybeInvalidateProgram(
existingWatch: ts.WatchOfConfigFile<ts.SemanticDiagnosticsBuilderProgram>,
existingWatch: ts.WatchOfConfigFile<ts.BuilderProgram>,
filePath: CanonicalPath,
tsconfigPath: CanonicalPath,
): ts.Program | null {
Expand Down

0 comments on commit 2405fae

Please sign in to comment.