Skip to content

Commit a7a0c33

Browse files
Improve ts6307 error (microsoft#31706)
Improve ts6307 error
2 parents 79aff02 + c5578a2 commit a7a0c33

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,7 @@
39563956
"category": "Error",
39573957
"code": 6306
39583958
},
3959-
"File '{0}' is not in project file list. Projects must list all files or use an 'include' pattern.": {
3959+
"File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern.": {
39603960
"category": "Error",
39613961
"code": 6307
39623962
},
@@ -4295,7 +4295,7 @@
42954295
"Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": {
42964296
"category": "Error",
42974297
"code": 7053
4298-
},
4298+
},
42994299
"No index signature with a parameter of type '{0}' was found on type '{1}'.": {
43004300
"category": "Error",
43014301
"code": 7054

src/compiler/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2773,7 +2773,7 @@ namespace ts {
27732773
// Ignore file that is not emitted
27742774
if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue;
27752775
if (rootPaths.indexOf(file.path) === -1) {
2776-
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
2776+
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || ""));
27772777
}
27782778
}
27792779
}

src/testRunner/unittests/config/projectReferences.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ namespace ts {
194194

195195
testProjectReferences(spec, "/primary/tsconfig.json", program => {
196196
const errs = program.getOptionsDiagnostics();
197-
assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern);
197+
assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern);
198198
});
199199
});
200200

@@ -344,7 +344,7 @@ namespace ts {
344344
};
345345
testProjectReferences(spec, "/alpha/tsconfig.json", (program) => {
346346
assertHasError("Issues an error about the rootDir", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files);
347-
assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern);
347+
assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern);
348348
});
349349
});
350350
});

src/testRunner/unittests/tsbuild/resolveJsonModule.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ namespace ts {
2929

3030
it("with resolveJsonModule and include only", () => {
3131
verifyProjectWithResolveJsonModule("/src/tsconfig_withInclude.json", [
32-
Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern,
33-
"/src/src/hello.json"
32+
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
33+
"/src/src/hello.json",
34+
"/src/tsconfig_withInclude.json"
3435
]);
3536
});
3637

0 commit comments

Comments
 (0)