Skip to content

Allow empty files lists in tsconfigs with an extends member #27383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,8 @@ namespace ts {
filesSpecs = <ReadonlyArray<string>>raw.files;
const hasReferences = hasProperty(raw, "references") && !isNullOrUndefined(raw.references);
const hasZeroOrNoReferences = !hasReferences || raw.references.length === 0;
if (filesSpecs.length === 0 && hasZeroOrNoReferences) {
const hasExtends = hasProperty(raw, "extends");
if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) {
if (sourceFile) {
const fileName = configFileName || "tsconfig.json";
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
Expand Down
14 changes: 14 additions & 0 deletions src/testRunner/unittests/configurationExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ namespace ts {
include: null,
files: ["../main.ts"]
}),
"dev/configs/fifth.json": JSON.stringify({
extends: "./fourth",
include: ["../tests/utils.ts"],
files: []
}),
"dev/extends.json": JSON.stringify({ extends: 42 }),
"dev/extends2.json": JSON.stringify({ extends: "configs/base" }),
"dev/main.ts": "",
Expand Down Expand Up @@ -245,6 +250,15 @@ namespace ts {
combinePaths(basePath, "main.ts")
]);

testSuccess("can overwrite top-level files using extended []", "configs/fifth.json", {
allowJs: true,
noImplicitAny: true,
strictNullChecks: true,
module: ModuleKind.System
}, [
combinePaths(basePath, "tests/utils.ts")
]);

it("adds extendedSourceFiles only once", () => {
const sourceFile = readJsonConfigFile("configs/fourth.json", (path) => host.readFile(path));
const dir = combinePaths(basePath, "configs");
Expand Down