Skip to content

Commit 22c0444

Browse files
committed
Missing files are versions are stored as number
1 parent 2684784 commit 22c0444

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/compiler/watch.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,7 @@ namespace ts {
420420
}
421421
}
422422

423-
const intialVersion = 1;
424-
const intialVersionString = "1";
423+
const initialVersion = 1;
425424

426425
/**
427426
* Creates the watch from the host for root files and compiler options
@@ -437,7 +436,7 @@ namespace ts {
437436
sourceFile: SourceFile;
438437
fileWatcher: FileWatcher;
439438
}
440-
type FileMissingOnHost = string;
439+
type FileMissingOnHost = number;
441440
interface FilePresenceUnknownOnHost {
442441
version: number;
443442
}
@@ -637,7 +636,7 @@ namespace ts {
637636
}
638637

639638
function isFileMissingOnHost(hostSourceFile: HostFileInfo): hostSourceFile is FileMissingOnHost {
640-
return isString(hostSourceFile);
639+
return typeof hostSourceFile === "number";
641640
}
642641

643642
function isFilePresentOnHost(hostSourceFile: FileMayBePresentOnHost): hostSourceFile is FilePresentOnHost {
@@ -683,17 +682,17 @@ namespace ts {
683682
if (isFilePresentOnHost(hostSourceFile)) {
684683
hostSourceFile.fileWatcher.close();
685684
}
686-
sourceFilesCache.set(path, hostSourceFile.version.toString());
685+
sourceFilesCache.set(path, hostSourceFile.version);
687686
}
688687
}
689688
else {
690689
if (sourceFile) {
691-
sourceFile.version = intialVersionString;
690+
sourceFile.version = initialVersion.toString();
692691
const fileWatcher = watchFilePath(host, fileName, onSourceFileChange, path, writeLog);
693-
sourceFilesCache.set(path, { sourceFile, version: intialVersion, fileWatcher });
692+
sourceFilesCache.set(path, { sourceFile, version: initialVersion, fileWatcher });
694693
}
695694
else {
696-
sourceFilesCache.set(path, intialVersionString);
695+
sourceFilesCache.set(path, initialVersion);
697696
}
698697
}
699698
return sourceFile;

0 commit comments

Comments
 (0)