From a58fdf2b35f33fd7bfb29b65eafd43e920d1ab8c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 1 May 2019 10:14:11 -0700 Subject: [PATCH] Include only files that can be emitted into the source file directory check for composite projects Fixes #31181 --- src/compiler/program.ts | 6 ++---- ...mpositeWithNodeModulesSourceFile.errors.txt | 18 ------------------ 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 tests/baselines/reference/compositeWithNodeModulesSourceFile.errors.txt diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 7e01e56f0693d..6f7ffc2c3a972 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -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)); } diff --git a/tests/baselines/reference/compositeWithNodeModulesSourceFile.errors.txt b/tests/baselines/reference/compositeWithNodeModulesSourceFile.errors.txt deleted file mode 100644 index be5aebfd5bcd1..0000000000000 --- a/tests/baselines/reference/compositeWithNodeModulesSourceFile.errors.txt +++ /dev/null @@ -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 { } - \ No newline at end of file