mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Fix(51828): extends field in tsconfig.json does nothing with empty string (#51981)
This commit is contained in:
1 parent
9c9d4b029d
commit
f6fc444b33
4 files changed
+27
-3
No files matched your search
@@ -3279,7 +3279,7 @@ function parseOwnConfigOfJson(
|
||||
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
|
||||
let extendedConfigPath: string | string[] | undefined;
|
||||
|
||||
if (json.extends) {
|
||||
if (json.extends || json.extends === "") {
|
||||
if (!isCompilerOptionsValue(extendsOptionDeclaration, json.extends)) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration)));
|
||||
}
|
||||
@@ -3293,7 +3293,7 @@ function parseOwnConfigOfJson(
|
||||
for (const fileName of json.extends as unknown[]) {
|
||||
if (isString(fileName)) {
|
||||
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
|
||||
}
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
|
||||
}
|
||||
@@ -3428,7 +3428,12 @@ function getExtendsConfigPath(
|
||||
if (resolved.resolvedModule) {
|
||||
return resolved.resolvedModule.resolvedFileName;
|
||||
}
|
||||
errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
|
||||
if (extendedConfig === "") {
|
||||
errors.push(createDiagnostic(Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
|
||||
}
|
||||
else {
|
||||
errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user