From b66b7525617ecb1bd5b70944224e6b80db7bf772 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 18 Aug 2017 11:15:42 -0700 Subject: [PATCH] Update based on feedback --- src/compiler/core.ts | 2 +- src/compiler/sys.ts | 3 +++ src/harness/unittests/programMissingFiles.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 1eab3582cb9..e1193d7f71b 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2736,7 +2736,7 @@ namespace ts { function fileExists(fileName: string): boolean { const path = toPath(fileName); const result = getCachedFileSystemEntriesForBaseDir(path); - return (result && hasEntry(result.files, getBaseNameOfFileName(fileName))) || + return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || host.fileExists(fileName); } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index aafb97f4131..982d6793819 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -30,6 +30,9 @@ namespace ts { mtime?: Date; } + /** + * Partial interface of the System thats needed to support the caching of directory structure + */ export interface PartialSystem { writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; fileExists(path: string): boolean; diff --git a/src/harness/unittests/programMissingFiles.ts b/src/harness/unittests/programMissingFiles.ts index 20323b37380..ce8abc232e7 100644 --- a/src/harness/unittests/programMissingFiles.ts +++ b/src/harness/unittests/programMissingFiles.ts @@ -3,7 +3,7 @@ namespace ts { function verifyMissingFilePaths(missingPaths: ReadonlyArray, expected: ReadonlyArray) { assert.isDefined(missingPaths); - const map = arrayToMap(expected, k => k, _v => true); + const map = arrayToSet(expected) as Map; for (const missing of missingPaths) { const value = map.get(missing); assert.isTrue(value, `${missing} to be ${value === undefined ? "not present" : "present only once"}, in actual: ${missingPaths} expected: ${expected}`);