Include only files that can be emitted into the source file directory check for composite projects

Fixes #31181
This commit is contained in:
Sheetal Nandi 2019-05-01 10:14:11 -07:00
parent 3df65a7a85
commit a58fdf2b35
2 changed files with 2 additions and 22 deletions

View File

@ -2768,10 +2768,8 @@ namespace ts {
if (options.composite) {
const rootPaths = rootNames.map(toPath);
for (const file of files) {
// Ignore declaration files
if (file.isDeclarationFile) continue;
// Ignore json file thats from project reference
if (isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName)) continue;
// Ignore file that is not emitted
if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
}

View File

@ -1,18 +0,0 @@
error TS6307: File '/foo/node_modules/myModule/index.ts' is not in project file list. Projects must list all files or use an 'include' pattern.
!!! error TS6307: File '/foo/node_modules/myModule/index.ts' is not in project file list. Projects must list all files or use an 'include' pattern.
==== /foo/tsconfig.json (0 errors) ====
{
"compilerOptions": { "composite": true },
"exclude": [ "node_modules" ]
}
==== /foo/test.ts (0 errors) ====
import myModule = require("myModule");
new myModule.c();
==== /foo/node_modules/myModule/index.ts (0 errors) ====
export class c { }