Ensure that from tsc with --incremental sets source file version

Fixes #30588 and #30589
This commit is contained in:
Sheetal Nandi 2019-03-26 13:42:58 -07:00
parent 684c531386
commit e28869d888
2 changed files with 2 additions and 1 deletions

View File

@ -275,7 +275,7 @@ namespace ts {
}
}
export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: ProgramHost<any>) {
export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: { createHash?(data: string): string; }) {
const originalGetSourceFile = compilerHost.getSourceFile;
const computeHash = host.createHash || generateDjb2Hash;
compilerHost.getSourceFile = (...args) => {

View File

@ -263,6 +263,7 @@ namespace ts {
const host = createCompilerHost(options);
const currentDirectory = host.getCurrentDirectory();
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
setGetSourceFileAsHashVersioned(host, sys);
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
enableStatistics(options);
const oldProgram = readBuilderProgram(options, path => host.readFile(path));