From e28869d888b89708a00d1fd6529caa1599b97c46 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 26 Mar 2019 13:42:58 -0700 Subject: [PATCH] Ensure that from tsc with --incremental sets source file version Fixes #30588 and #30589 --- src/compiler/watch.ts | 2 +- src/tsc/tsc.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 8a94393e2ce..6206c22eeba 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -275,7 +275,7 @@ namespace ts { } } - export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: ProgramHost) { + export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: { createHash?(data: string): string; }) { const originalGetSourceFile = compilerHost.getSourceFile; const computeHash = host.createHash || generateDjb2Hash; compilerHost.getSourceFile = (...args) => { diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 499848fdf92..31b5d7d75d8 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -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));