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

Fixes #30588 and #30589
This commit is contained in:
Sheetal Nandi committed 2019-03-26 14:25:47 -07:00
1 parent 684c531386
commit e28869d888
2 files changed
+2 -1

No files matched your search

+1 -1
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) => {
+1
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));