Skip to content

Commit 8ca01df

Browse files
Merge pull request #26851 from ajafff/assert-compilerhost-readdirectory
Assert CompilerHost.readDiretory for projectReferences with include
2 parents 59e4770 + d519e3f commit 8ca01df

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/compiler/program.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2850,7 +2850,10 @@ namespace ts {
28502850
export function parseConfigHostFromCompilerHost(host: CompilerHost): ParseConfigFileHost {
28512851
return {
28522852
fileExists: f => host.fileExists(f),
2853-
readDirectory: (root, extensions, includes, depth?) => host.readDirectory ? host.readDirectory(root, extensions, includes, depth) : [],
2853+
readDirectory(root, extensions, excludes, includes, depth) {
2854+
Debug.assertDefined(host.readDirectory, "'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'");
2855+
return host.readDirectory!(root, extensions, excludes, includes, depth);
2856+
},
28542857
readFile: f => host.readFile(f),
28552858
useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(),
28562859
getCurrentDirectory: () => host.getCurrentDirectory(),

src/services/services.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,10 @@ namespace ts {
12181218
getDirectories: path => {
12191219
return host.getDirectories ? host.getDirectories(path) : [];
12201220
},
1221+
readDirectory(path, extensions, exclude, include, depth) {
1222+
Debug.assertDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
1223+
return host.readDirectory!(path, extensions, exclude, include, depth);
1224+
},
12211225
onReleaseOldSourceFile,
12221226
hasInvalidatedResolution,
12231227
hasChangedAutomaticTypeDirectiveNames: host.hasChangedAutomaticTypeDirectiveNames

0 commit comments

Comments
 (0)