mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Handle empty string when getting file version (#51689)
* Test for empty string change * Fix empty string for file versioning
This commit is contained in:
@@ -1811,7 +1811,7 @@ function getUpToDateStatusWorker(state: SolutionBuilderState, project: ParsedCom
|
||||
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath!, host);
|
||||
version = buildInfoVersionMap.get(toPath(state, inputFile));
|
||||
const text = version ? state.readFileWithCache(inputFile) : undefined;
|
||||
currentVersion = text && getSourceFileVersionAsHashFromText(host, text);
|
||||
currentVersion = text !== undefined ? getSourceFileVersionAsHashFromText(host, text) : undefined;
|
||||
if (version && version === currentVersion) pseudoInputUpToDate = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -715,7 +715,7 @@ export function createWatchProgram<T extends BuilderProgram>(host: WatchCompiler
|
||||
if (hostSourceFile.version) return hostSourceFile.version;
|
||||
// Read file and get new version
|
||||
const text = readFileWithCache(path);
|
||||
return text ? getSourceFileVersionAsHashFromText(compilerHost, text) : undefined;
|
||||
return text !== undefined ? getSourceFileVersionAsHashFromText(compilerHost, text) : undefined;
|
||||
}
|
||||
|
||||
function onReleaseOldSourceFile(oldSourceFile: SourceFile, _oldOptions: CompilerOptions, hasSourceFileByPath: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user