From 3806ee74063849930504bf52f0eb809b0fc6b2d7 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Sun, 2 Sep 2018 21:42:38 +0200 Subject: [PATCH 1/2] Assert CompilerHost.readDiretory for projectReferences with include Fixes: #26785 --- src/compiler/program.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2bbf17e609826..ea331db57d236 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2811,7 +2811,10 @@ namespace ts { export function parseConfigHostFromCompilerHost(host: CompilerHost): ParseConfigFileHost { return { fileExists: f => host.fileExists(f), - readDirectory: (root, extensions, includes, depth?) => host.readDirectory ? host.readDirectory(root, extensions, includes, depth) : [], + readDirectory(root, extensions, excludes, includes, depth) { + Debug.assertDefined(host.readDirectory, "'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'"); + return host.readDirectory!(root, extensions, excludes, includes, depth); + }, readFile: f => host.readFile(f), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(), getCurrentDirectory: () => host.getCurrentDirectory(), From d519e3f21ec36274726c44dab25c9eb48e34953f Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 3 Sep 2018 09:51:02 +0200 Subject: [PATCH 2/2] hand over to LanguageServiceHost.readDirectory --- src/services/services.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/services.ts b/src/services/services.ts index dcc321b00d58c..e9af862d0020a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1217,6 +1217,10 @@ namespace ts { getDirectories: path => { return host.getDirectories ? host.getDirectories(path) : []; }, + readDirectory(path, extensions, exclude, include, depth) { + Debug.assertDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'"); + return host.readDirectory!(path, extensions, exclude, include, depth); + }, onReleaseOldSourceFile, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames: host.hasChangedAutomaticTypeDirectiveNames