Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tristonarmstrong authored Oct 18, 2024
2 parents b653834 + 54732f6 commit 61eafe6
Show file tree
Hide file tree
Showing 32 changed files with 215 additions and 118 deletions.
15 changes: 14 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
addToSeen,
AlternateModeDiagnostics,
append,
arrayFrom,
Expand Down Expand Up @@ -2629,7 +2630,7 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
const providedKeys = new Set(optionMap.keys());
const impliedCompilerOptions: Record<string, CompilerOptionsValue> = {};
for (const option in computedOptions) {
if (!providedKeys.has(option) && some(computedOptions[option].dependencies, dep => providedKeys.has(dep))) {
if (!providedKeys.has(option) && optionDependsOn(option, providedKeys)) {
const implied = computedOptions[option].computeValue(configParseResult.options);
const defaultValue = computedOptions[option].computeValue({});
if (implied !== defaultValue) {
Expand All @@ -2641,6 +2642,18 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
return config;
}

function optionDependsOn(option: string, dependsOn: Set<string>): boolean {
const seen = new Set<string>();
return optionDependsOnRecursive(option);

function optionDependsOnRecursive(option: string): boolean {
if (addToSeen(seen, option)) {
return some(computedOptions[option]?.dependencies, dep => dependsOn.has(dep) || optionDependsOnRecursive(dep));
}
return false;
}
}

/** @internal */
export function optionMapToObject(optionMap: Map<string, CompilerOptionsValue>): object {
return Object.fromEntries(optionMap);
Expand Down
8 changes: 2 additions & 6 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8193,15 +8193,11 @@ export function getLastChild(node: Node): Node | undefined {
*
* @internal
*/
export function addToSeen<K>(seen: Map<K, true>, key: K): boolean;
/** @internal */
export function addToSeen<K, T>(seen: Map<K, T>, key: K, value: T): boolean;
/** @internal */
export function addToSeen<K, T>(seen: Map<K, T>, key: K, value: T = true as any): boolean {
export function addToSeen<K>(seen: Set<K>, key: K): boolean {
if (seen.has(key)) {
return false;
}
seen.set(key, value);
seen.add(key);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2784,11 +2784,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[至少一个访问器必须具有带有 --isolatedDeclarations 的显式返回类型注释。]]></Val>
<Val><![CDATA[至少一个访问器必须具有带有 --isolatedDeclarations 的显式类型注释。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5040,11 +5040,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[为此参数发出的声明要求隐式添加未定义的类型。--isolatedDeclarations 不支持此功能。]]></Val>
<Val><![CDATA[为此参数发出的声明要求将未定义隐式添加到其类型。--isolatedDeclarations 不支持此功能。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -11548,7 +11548,7 @@
<Str Cat="Text">
<Val><![CDATA[Property '{0}' cannot have an initializer because it is marked abstract.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[属性“{0}”不能具有初始化表杰式,因为它标记为摘要。]]></Val>
<Val><![CDATA[属性“{0}”不能具有初始化表达式,因为它标记为摘要。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2784,11 +2784,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[至少一個存取子必須有具備 --isolatedDeclarations 的明確傳回類型註解。]]></Val>
<Val><![CDATA[至少一個存取子必須有具備 --isolatedDeclarations 的明確型別註釋。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5040,11 +5040,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[此參數發出的宣告需要隱含地新增未定義值至其類型。該情況不受 --isolatedDeclarations 支援。]]></Val>
<Val><![CDATA[此參數發出的宣告需要隱含地新增未定義值至其類型。此情況不受 --isolatedDeclarations 支援。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2793,11 +2793,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Alespoň jeden přistupující objekt musí mít explicitní anotaci návratového typu s možností --isolatedDeclarations.]]></Val>
<Val><![CDATA[Minimálně jeden přistupující objekt musí mít explicitní anotaci typu s možností --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5049,11 +5049,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Generování deklarace pro tento parametr vyžaduje implicitně přidání možnosti „undefined“ do jeho typu. Toto není podporováno s možností --isolatedDeclarations.]]></Val>
<Val><![CDATA[Generování deklarace pro tento parametr vyžaduje implicitní přidání možnosti „undefined“ do jeho typu. Není podporováno s možností --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2781,11 +2781,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Mindestens ein Accessor muss eine explizite Rückgabetypanmerkung mit "--isolatedDeclarations" aufweisen.]]></Val>
<Val><![CDATA[Mindestens ein Accessor muss über eine explizite Typanmerkung mit --isolatedDeclarations“ verfügen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5037,11 +5037,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Deklarationsausgabe für diesen Parameter erfordert das implizit undefinierte Hinzufügen zum Typ. Dies wird mit "--isolatedDeclarations" nicht unterstützt.]]></Val>
<Val><![CDATA[Die Deklarationsausgabe für diesen Parameter erfordert das implizit undefinierte Hinzufügen zum Typ. Dies wird mit --isolatedDeclarations nicht unterstützt.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2796,11 +2796,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Al menos un descriptor de acceso debe tener una anotación de tipo de valor devuelto explícita con --isolatedDeclarations.]]></Val>
<Val><![CDATA[Al menos un descriptor de acceso debe tener una anotación de tipo explícita con --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5052,9 +5052,9 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La emisión de declaración para este parámetro requiere agregar implícitamente un elemento no definido a su tipo. Esto no se admite con --isolatedDeclarations.]]></Val>
</Tgt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2796,11 +2796,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Au moins un accesseur doit avoir une annotation de type de retour explicite avec --isolatedDeclarations.]]></Val>
<Val><![CDATA[Au moins un accesseur doit avoir une annotation de type explicite avec --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5052,11 +5052,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L’émission de déclaration pour ce paramètre nécessite l’ajout implicite non défini à son type. Cette opération n’est pas pris en charge avec --isolatedDeclarations.]]></Val>
<Val><![CDATA[L’émission de déclaration pour ce paramètre nécessite l’ajout implicite de « non défini » à son type. Cette opération n’est pas pris en charge avec --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2784,11 +2784,11 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";At_least_one_accessor_must_have_an_explicit_type_annotation_with_isolatedDeclarations_9009" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[At least one accessor must have an explicit return type annotation with --isolatedDeclarations.]]></Val>
<Val><![CDATA[At least one accessor must have an explicit type annotation with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Almeno una funzione di accesso deve avere un'annotazione di tipo restituito esplicita con --isolatedDeclarations.]]></Val>
<Val><![CDATA[Almeno una funzione di accesso deve avere un'annotazione di tipo esplicita con --isolatedDeclarations.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down Expand Up @@ -5040,9 +5040,9 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.]]></Val>
<Val><![CDATA[Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La creazione di dichiarazioni per questo parametro richiede l'aggiunta implicita di elementi non definiti al relativo tipo. Funzionalità non supportata con --isolatedDeclarations.]]></Val>
</Tgt>
Expand Down
Loading

0 comments on commit 61eafe6

Please sign in to comment.