diff --git a/lib/cs/diagnosticMessages.generated.json b/lib/cs/diagnosticMessages.generated.json index e75af197f6507..cb2a1b883cb1d 100644 --- a/lib/cs/diagnosticMessages.generated.json +++ b/lib/cs/diagnosticMessages.generated.json @@ -1427,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Levá strana aritmetické operace musí mít typ any, number, bigint nebo být typu výčtu.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Levá strana výrazu přiřazení nemůže představovat přístup k nepovinné vlastnosti.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Levá strana výrazu přiřazení musí být proměnná nebo přístup k vlastnosti.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Levá strana výrazu in musí být privátní identifikátor nebo typu any, string, number nebo symbol.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Levá strana výrazu instanceof musí být typu any, typem objektu nebo parametrem typu.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Národní prostředí, které se používá při zobrazování zpráv uživateli (třeba cs-CZ)", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Maximální hloubka závislostí pro vyhledávání pod node_modules a načítání javascriptových souborů", @@ -1448,7 +1447,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Návratový typ asynchronní funkce nebo metody musí být globální typ Promise. Zamýšleli jste napsat Promise<{0}>?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Pravá strana příkazu for...in musí být typu any, typem objektu nebo parametrem typu, ale tady má typ {0}.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Pravá strana aritmetické operace musí mít typ any, number, bigint nebo být typu výčtu.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Pravá strana výrazu in nesmí být primitivní typ.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Pravá strana výrazu instanceof musí mít typ any nebo typ, který se dá přiřadit k typu rozhraní Function.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Kořenová hodnota souboru {0} musí být objekt.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Překrývající deklarace {0} je definovaná tady.", @@ -1476,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Vlastnost {0} této značky JSX očekává jeden podřízený objekt typu {1}, ale poskytlo se jich více.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Vlastnost {0} této značky JSX očekává typ {1}, který vyžaduje více podřízených objektů, ale zadal se jen jeden.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Toto porovnání se zdá být neúmyslné, protože typy {0} a {1} se nijak nepřekrývají.", + "This_condition_will_always_return_0_2845": "Tato podmínka vždy vrátí {0}.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Tato podmínka vždy vrátí „{0}“, protože JavaScript porovnává objekty pomocí odkazu, nikoli hodnoty.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Tato podmínka vždy vrátí hodnotu True, protože tato {0} je vždy definovaná.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Tato podmínka vždy vrátí hodnotu True, protože tato funkce je vždy definována. Chtěli jste ji místo toho nazvat?", @@ -1551,6 +1550,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Typ {0} se nedá přiřadit k typu {1} s hodnotou exactOptionalPropertyTypes: true. Zvažte možnost přidat hodnotu undefined do typu cíle.", "Type_0_is_not_comparable_to_type_1_2678": "Typ {0} se nedá porovnat s typem {1}.", "Type_0_is_not_generic_2315": "Typ {0} není obecný.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ {0} může představovat primitivní hodnotu, která není povolena jako pravý operand operátoru in.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Typ {0} musí mít metodu [Symbol.asyncIterator](), která vrací asynchronní iterátor.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Typ {0} musí mít metodu [Symbol.iterator](), která vrací iterátor.", "Type_0_provides_no_match_for_the_signature_1_2658": "Typ {0} neposkytuje žádnou shodu pro podpis {1}.", @@ -1649,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Aktualizuje se výstup projektu {0}...", "Updating_output_timestamps_of_project_0_6359": "Aktualizují se výstupní časová razítka projektu {0}...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Aktualizují se nezměněná výstupní časová razítka projektu {0}...", + "Use_0_95174": "Použít {0}", + "Use_Number_isNaN_in_all_conditions_95175": "Ve všech podmínkách použijte Number.isNaN.", "Use_element_access_for_0_95145": "Použít přístup k elementům pro {0}", "Use_element_access_for_all_undeclared_properties_95146": "Použít přístup k elementům pro všechny nedeklarované vlastnosti", "Use_synthetic_default_member_95016": "Použije syntetického výchozího člena.", diff --git a/lib/de/diagnosticMessages.generated.json b/lib/de/diagnosticMessages.generated.json index 7a87b1eebfe35..0da02b28234f9 100644 --- a/lib/de/diagnosticMessages.generated.json +++ b/lib/de/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Die Eigenschaft \"{0}\" für dieses JSX-Tag erwartet ein einzelnes untergeordnetes Element vom Typ \"{1}\", aber es wurden mehrere untergeordnete Elemente angegeben.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Die Eigenschaft \"{0}\" für dieses JSX-Tag erwartet den Typ \"{1}\", der mehrere untergeordnete Elemente erfordert, aber es wurde nur ein untergeordnetes Elemente angegeben.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Dieser Vergleich scheint unbeabsichtigt zu sein, da die Typen \"{0}\" und \"{1}\" keine Überlappung aufweisen.", + "This_condition_will_always_return_0_2845": "Diese Bedingung gibt immer „{0}“ zurück.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Diese Bedingung gibt immer „{0}“ zurück, da JavaScript Objekte nach Verweis und nicht nach Wert vergleicht.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Diese Bedingung gibt immer TRUE zurück, weil diese '{0}' immer definiert ist.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Diese Bedingung gibt immer TRUE zurück, weil diese Funktion immer definiert ist. Möchten Sie sie stattdessen aufrufen?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Ausgabe von Projekt \"{0}\" wird aktualisiert...", "Updating_output_timestamps_of_project_0_6359": "Ausgabezeitstempel von Projekt \"{0}\" werden aktualisiert...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Unveränderte Ausgabezeitstempel von Projekt \"{0}\" werden aktualisiert...", + "Use_0_95174": "Verwenden Sie „{0}“.", + "Use_Number_isNaN_in_all_conditions_95175": "Verwenden Sie „Number.isNaN“ unter allen Bedingungen.", "Use_element_access_for_0_95145": "Elementzugriff für \"{0}\" verwenden", "Use_element_access_for_all_undeclared_properties_95146": "Elementzugriff für alle nicht deklarierten Eigenschaften verwenden", "Use_synthetic_default_member_95016": "Verwenden Sie den synthetischen Member \"default\".", diff --git a/lib/es/diagnosticMessages.generated.json b/lib/es/diagnosticMessages.generated.json index 2d36e561a3e12..d0267638bd3ac 100644 --- a/lib/es/diagnosticMessages.generated.json +++ b/lib/es/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "La propiedad \"{0}\" de esta etiqueta de JSX espera un solo elemento secundario de tipo \"{1}\", pero se han proporcionado varios elementos secundarios.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "La propiedad \"{0}\" de esta etiqueta de JSX espera el tipo \"{1}\", que requiere varios elementos secundarios, pero solo se ha proporcionado un elemento secundario.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Esta comparación parece no intencionada porque los tipos \"{0}\" y \"{1}\" no tienen superposición.", + "This_condition_will_always_return_0_2845": "Esta condición siempre devolverá \"{0}\".", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Esta condición siempre devolverá \"{0}\", ya que JavaScript compara objetos por referencia, no por valor.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Esta condición devolverá siempre true porque siempre se define '{0}'.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Esta condición siempre devolverá true, porque esta función se define siempre. ¿Pretendía llamarla en su lugar?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Actualizando la salida del proyecto \"{0}\"...", "Updating_output_timestamps_of_project_0_6359": "Actualizando las marcas de hora de salida del proyecto \"{0}\"...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Actualizando las marcas de hora de salida no modificadas del proyecto \"{0}\"...", + "Use_0_95174": "Usar `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Use \"Number.isNaN\" en todas las condiciones.", "Use_element_access_for_0_95145": "Usar acceso de elemento para \"{0}\"", "Use_element_access_for_all_undeclared_properties_95146": "Use el acceso de elemento para todas las propiedades no declaradas.", "Use_synthetic_default_member_95016": "Use el miembro sintético \"default\".", diff --git a/lib/fr/diagnosticMessages.generated.json b/lib/fr/diagnosticMessages.generated.json index 2a520a280a134..d28fa0309fa7b 100644 --- a/lib/fr/diagnosticMessages.generated.json +++ b/lib/fr/diagnosticMessages.generated.json @@ -1427,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "La partie gauche d'une opération arithmétique doit être de type 'any', 'number', 'bigint' ou un type enum.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La partie gauche d'une expression d'assignation ne doit pas être un accès à une propriété facultative.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La partie gauche d'une expression d'assignation doit être un accès à une variable ou une propriété.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La partie gauche d'une expression 'in' doit être un identificateur privé ou de type 'any', 'string', 'number' ou 'symbol'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "La partie gauche d'une expression 'instanceof' doit être de type 'any', un type d'objet ou un paramètre de type.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Paramètres régionaux utilisés pour afficher les messages à l'utilisateur (exemple : 'fr-fr')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Profondeur de dépendance maximale pour la recherche sous node_modules et le chargement de fichiers JavaScript.", @@ -1448,7 +1447,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Le type de retour d'une fonction ou d'une méthode asynchrone doit être le type global Promise. Vouliez-vous vraiment écrire 'Promise<{0}>' ?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "La partie droite d'une instruction 'for...in' doit être de type 'any', un type d'objet ou un paramètre de type, mais elle a le type '{0}' ici.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La partie droite d'une opération arithmétique doit être de type 'any', 'number', 'bigint' ou un type enum.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La partie droite d'une expression 'in' ne doit pas être une primitive.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La partie droite d'une expression 'instanceof' doit être de type 'any' ou d'un type pouvant être assigné au type d'interface 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "La valeur racine d'un fichier '{0}' doit être un objet.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La déclaration avec mise en mémoire fantôme de '{0}' est définie ici", @@ -1476,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "La propriété '{0}' de cette balise JSX attend un seul enfant de type '{1}', mais plusieurs enfants ont été fournis.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "La propriété '{0}' de cette balise JSX attend le type '{1}', qui nécessite plusieurs enfants, mais un seul enfant a été fourni.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Cette comparaison semble involontaire, car les types '{0}' et '{1}' n’ont pas de chevauchement.", + "This_condition_will_always_return_0_2845": "Cette condition retourne toujours '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Cette condition retourne toujours '{0}', car JavaScript compare les objets par référence, et non par valeur.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Cette condition retourne toujours true, car cette « {0} » est toujours définie.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Cette condition retourne toujours true, car cette fonction est toujours définie. Est-ce que vous avez voulu l'appeler à la place ?", @@ -1551,6 +1550,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Le type '{0}' n'est pas assignable au type '{1}' avec 'exactOptionalPropertyTypes : true'. Pensez à ajouter 'undefined' au type de la cible.", "Type_0_is_not_comparable_to_type_1_2678": "Le type '{0}' n'est pas comparable au type '{1}'.", "Type_0_is_not_generic_2315": "Le type '{0}' n'est pas générique.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Le type '{0}' peut représenter une valeur primitive, ce qui n’est pas autorisé en tant qu’opérande droit de l’opérateur 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Le type '{0}' doit avoir une méthode '[Symbol.asyncIterator]()' qui retourne un itérateur asynchrone.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Le type '{0}' doit avoir une méthode '[Symbol.iterator]()' qui retourne un itérateur.", "Type_0_provides_no_match_for_the_signature_1_2658": "Le type '{0}' ne fournit aucune correspondance pour la signature '{1}'.", @@ -1649,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Mise à jour de la sortie du projet '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Mise à jour des horodatages de sortie du projet '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Mise à jour des horodatages de sortie inchangés du projet '{0}'...", + "Use_0_95174": "Utilisez `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Utilisez 'Number.isNaN' dans toutes les conditions.", "Use_element_access_for_0_95145": "Utiliser l'accès à l'élément pour '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "L'accès à l'élément est utilisé pour toutes les propriétés non déclarées.", "Use_synthetic_default_member_95016": "Utilisez un membre 'default' synthétique.", diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json index d5cf261116550..bda91d68bffa4 100644 --- a/lib/it/diagnosticMessages.generated.json +++ b/lib/it/diagnosticMessages.generated.json @@ -1427,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "La parte sinistra di un'operazione aritmetica deve essere di tipo 'any', 'number', 'bigint' o un tipo enumerazione.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La parte sinistra di un'espressione di assegnazione non può essere un accesso a proprietà facoltativo.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La parte sinistra di un'espressione di assegnazione deve essere una variabile o un accesso a proprietà.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La parte sinistra di un'espressione 'in' deve essere un identificatore privato o di tipo 'any', 'string', 'number' o 'symbol'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "La parte sinistra di un'espressione 'instanceof' deve essere di tipo 'any' oppure essere un tipo di oggetto o un parametro di tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Impostazioni locali usate per la visualizzazione di messaggi all'utente, ad esempio 'it-it'", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Profondità massima delle dipendenze per la ricerca in node_modules e il caricamento dei file JavaScript.", @@ -1448,7 +1447,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Il tipo restituito di un metodo o una funzione asincrona deve essere il tipo globale Promise. Si intendeva scrivere 'Promise<{0}>'?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "La parte destra di un'istruzione 'for...in' deve essere di tipo 'any' oppure essere un tipo di oggetto o un parametro di tipo, ma in questo caso il tipo è '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La parte destra di un'operazione aritmetica deve essere di tipo 'any', 'number', 'bigint' o un tipo enumerazione.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La parte destra di un'espressione 'in' non deve essere una primitiva.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La parte destra di un'espressione 'instanceof' deve essere di tipo 'any' o di un tipo assegnabile al tipo di interfaccia 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Il valore radice di un file '{0}' deve essere un oggetto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La dichiarazione di oscuramento di '{0}' viene definita in questo punto", @@ -1476,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Con la proprietà '{0}' del tag JSX è previsto un singolo elemento figlio di tipo '{1}', ma sono stati specificati più elementi figlio.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Con la proprietà '{0}' del tag JSX è previsto il tipo '{1}' che richiede più elementi figlio, ma è stato specificato un singolo elemento figlio.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Questo confronto sembra non intenzionale perché i tipi '{0}' e '{1}' non presentano alcuna sovrapposizione.", + "This_condition_will_always_return_0_2845": "Questa condizione restituirà sempre '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Questa condizione restituirà sempre '{0}' perché JavaScript confronta gli oggetti per riferimento, non per valore.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Questa condizione restituirà sempre true perché questo elemento '{0}' è sempre definito.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Questa condizione restituirà sempre true perché questa funzione è sempre definita. Si intendeva chiamarla?", @@ -1551,6 +1550,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "L'argomento di tipo '{0}' non può essere assegnato al tipo '{1}' con 'exactOptionalPropertyTypes: true'. Provare ad aggiungere 'undefined' al tipo di destinazione.", "Type_0_is_not_comparable_to_type_1_2678": "Il tipo '{0}' non è confrontabile con il tipo '{1}'.", "Type_0_is_not_generic_2315": "Il tipo '{0}' non è generico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Il tipo '{0}' può rappresentare un valore primitivo, che non è consentito come operando destro dell'operatore 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Il tipo '{0}' deve contenere un metodo '[Symbol.asyncIterator]()' che restituisce un iteratore asincrono.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Il tipo '{0}' deve contenere un metodo '[Symbol.iterator]()' che restituisce un iteratore.", "Type_0_provides_no_match_for_the_signature_1_2658": "Il tipo '{0}' non fornisce corrispondenze per la firma '{1}'.", @@ -1649,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Aggiornamento dell'output del progetto '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Aggiornamento dei timestamp di output del progetto '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Aggiornamento dei timestamp di output non modificati del progetto '{0}'...", + "Use_0_95174": "Usa `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Usare 'Number.isNaN' in tutte le condizioni.", "Use_element_access_for_0_95145": "Usare l'accesso agli elementi per '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "Usare l'accesso agli elementi per tutte le proprietà non dichiarate.", "Use_synthetic_default_member_95016": "Usare il membro 'default' sintetico.", diff --git a/lib/ja/diagnosticMessages.generated.json b/lib/ja/diagnosticMessages.generated.json index 33c8b7142a602..aa8ea651301ad 100644 --- a/lib/ja/diagnosticMessages.generated.json +++ b/lib/ja/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "この JSX タグの '{0}' prop は型 '{1}' の単一の子を予期しますが、複数の子が指定されました。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "この JSX タグの '{0}' prop は複数の子を必要とする型 '{1}' を予期しますが、単一の子が指定されました。", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}' 型と '{1}' 型が重複していないため、この比較は意図したとおりに表示されない可能性があります。", + "This_condition_will_always_return_0_2845": "この条件は常に '{0}' を返します。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript が値ではなく参照でオブジェクトを比較するため、この条件は常に '{0}' を返します。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "'{0}' が常に定義されているため、この条件は常に true を返します。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "この関数は常に定義されているため、この条件は常に true を返します。代わりにこれを呼び出すことを意図していましたか?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "プロジェクト '{0}' の出力を更新しています...", "Updating_output_timestamps_of_project_0_6359": "プロジェクト '{0}' の出力タイムスタンプを更新しています...", "Updating_unchanged_output_timestamps_of_project_0_6371": "プロジェクト '{0}' の変更されていない出力タイムスタンプを更新しています...", + "Use_0_95174": "\"{0}\" を使用します。", + "Use_Number_isNaN_in_all_conditions_95175": "すべての条件で 'Number.isNaN' を使用します。", "Use_element_access_for_0_95145": "'{0}' に要素アクセスを使用する", "Use_element_access_for_all_undeclared_properties_95146": "宣言されていないすべてのプロパティに対して要素アクセスを使用します。", "Use_synthetic_default_member_95016": "合成 'default' メンバーを使用します。", diff --git a/lib/ko/diagnosticMessages.generated.json b/lib/ko/diagnosticMessages.generated.json index 4d9732bbcff26..70ab275004880 100644 --- a/lib/ko/diagnosticMessages.generated.json +++ b/lib/ko/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "이 JSX 태그의 '{0}' 속성에는 '{1}' 형식의 자식 하나가 필요하지만, 여러 자식이 제공되었습니다.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "이 JSX 태그의 '{0}' 속성에는 여러 자식이 있어야 하는 '{1}' 형식이 필요하지만, 단일 자식만 제공되었습니다.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}'이(가) '{1}'과(와) 겹치지 않으므로 이 비교는 의도하지 않은 것 같습니다.", + "This_condition_will_always_return_0_2845": "이 조건은 항상 '{0}'을(를) 반환합니다.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript는 값이 아닌 참조로 개체를 비교하므로 이 조건은 항상 '{0}'을(를) 반환합니다.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "이 '{0}'(은)는 항상 정의되어 있으므로 이 조건은 항상 true를 반환합니다.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "함수가 항상 정의되므로 이 조건은 항상 true를 반환합니다. 대신 호출하시겠어요?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "'{0}' 프로젝트의 출력을 업데이트하는 중...", "Updating_output_timestamps_of_project_0_6359": "'{0}' 프로젝트의 출력 타임스탬프를 업데이트하는 중...", "Updating_unchanged_output_timestamps_of_project_0_6371": "'{0}' 프로젝트의 변경되지 않은 출력 타임스탬프를 업데이트하는 중...", + "Use_0_95174": "`{0}`을(를) 사용합니다.", + "Use_Number_isNaN_in_all_conditions_95175": "모든 조건에서 'Number.isNaN'을 사용합니다.", "Use_element_access_for_0_95145": "'{0}'에 요소 액세스 사용", "Use_element_access_for_all_undeclared_properties_95146": "선언되지 않은 모든 속성에 요소 액세스를 사용합니다.", "Use_synthetic_default_member_95016": "가상 '기본' 멤버를 사용합니다.", diff --git a/lib/pl/diagnosticMessages.generated.json b/lib/pl/diagnosticMessages.generated.json index 107a9859cd27d..051987abd9a2f 100644 --- a/lib/pl/diagnosticMessages.generated.json +++ b/lib/pl/diagnosticMessages.generated.json @@ -1427,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Lewa strona operacji arytmetycznej musi być typu „any”, „number”, „bigint” lub typu wyliczeniowego.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Lewa strona wyrażenia przypisania nie może być opcjonalnym dostępem do właściwości.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Lewa strona wyrażenia przypisania musi być zmienną lub dostępem do właściwości.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Lewa strona wyrażenia „in” musi być identyfikatorem prywatnym lub typem „any”, „string”, „number” lub „symbol”.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Lewa strona wyrażenia „instanceof” musi być typu „any”, typu obiektu lub parametrem typu.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Ustawienia regionalne używane przy wyświetlaniu komunikatów użytkownikowi (np. „pl-pl”)", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Maksymalna głębokość zależności na potrzeby wyszukiwania w elemencie node_modules i ładownia plików JavaScript.", @@ -1448,7 +1447,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Zwracany typ funkcji lub metody asynchronicznej musi być globalnym typem Promise. Czy chodziło Ci o typ „Promise<{0}>”?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Prawa strona instrukcji „for...in” musi zawierać typ „any”, typ obiektu lub parametr typu, a tutaj ma typ „{0}”.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Prawa strona operacji arytmetycznej musi być typu „any”, „number”, „bigint” lub typu wyliczeniowego.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Typ pierwotny nie może znajdować się po prawej stronie wyrażenia „in”.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Prawa strona wyrażenia „instanceof” musi być typu „any” lub typu, który można przypisać do typu interfejsu „Function”.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Wartość katalogu głównego pliku „{0}” musi być obiektem.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Deklaracja przesłaniania „{0}” jest zdefiniowana tutaj", @@ -1476,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Element prop „{0}” tego tagu JSX oczekuje pojedynczego elementu podrzędnego typu „{1}”, ale podano wiele elementów podrzędnych.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Element prop „{0}” tego tagu JSX oczekuje typu „{1}”, który wymaga wielu elementów podrzędnych, ale podano tylko jeden element podrzędny.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "To porównanie wydaje się niezamierzone, ponieważ typy „{0}” i „{1}” nie nakładają się na siebie.", + "This_condition_will_always_return_0_2845": "This condition will always return '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Ten warunek zawsze będzie zwracać wartość „{0}”, ponieważ język JavaScript porównuje obiekty według odwołania, a nie wartości.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Ten warunek będzie zawsze zwracać wartość true, ponieważ wartość '{0}' jest zawsze prawdziwa.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Ten warunek będzie zawsze zwracał wartość true, ponieważ funkcja jest zawsze zdefiniowana. Czy chcesz wywołać ją zamiast tego?", @@ -1551,6 +1550,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Nie można przypisać typu \"{0}\" do typu \"{1}\" o wartości \"exactOptionalPropertyTypes: true\". Rozważ dodanie elementu \"undefined\" do typu elementu docelowego.", "Type_0_is_not_comparable_to_type_1_2678": "Typu „{0}” nie można porównać z typem „{1}”.", "Type_0_is_not_generic_2315": "Typ „{0}” nie jest ogólny.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ „{0}” może reprezentować wartość pierwotną, co nie jest dozwolone jako prawy operand operatora „in”.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Typ „{0}” musi zawierać metodę „[Symbol.asyncIterator]()” zwracającą iterator asynchroniczny.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Typ „{0}” musi zawierać metodę „[Symbol.iterator]()” zwracającą iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "Typ „{0}” nie udostępnia dopasowania dla sygnatury „{1}”.", @@ -1649,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Trwa aktualizowanie danych wyjściowych projektu „{0}”...", "Updating_output_timestamps_of_project_0_6359": "Trwa aktualizowanie sygnatury czasowej danych wyjściowych projektu „{0}”...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Trwa aktualizowanie niezmienionych sygnatur czasowych danych wyjściowych projektu „{0}”...", + "Use_0_95174": "Use `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Use `Number.isNaN` in all conditions.", "Use_element_access_for_0_95145": "Użyj dostępu do elementu w przypadku elementu „{0}”", "Use_element_access_for_all_undeclared_properties_95146": "Użyj dostępu do elementu w przypadku wszystkich niezadeklarowanych właściwości.", "Use_synthetic_default_member_95016": "Użyj syntetycznej składowej „default”.", diff --git a/lib/pt-br/diagnosticMessages.generated.json b/lib/pt-br/diagnosticMessages.generated.json index 50245312a05dd..20cb273406b21 100644 --- a/lib/pt-br/diagnosticMessages.generated.json +++ b/lib/pt-br/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "A propriedade '{0}' da marca desse JSX espera um único filho do tipo '{1}', mas vários filhos foram fornecidos.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "A propriedade '{0}' da marca desse JSX espera o tipo '{1}' que requer vários filhos, mas somente um único filho foi fornecido.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Esta comparação parece não ser intencional porque os tipos '{0}' e '{1}' não têm sobreposição.", + "This_condition_will_always_return_0_2845": "Esta condição sempre retornará '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Essa condição sempre retornará '{0}', pois o JavaScript compara objetos por referência, não por valor.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Esta condição sempre retornará verdadeiro, já que este '{0}' está sempre definido.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Esta condição sempre retornará verdadeira, uma vez que esta função foi sempre definida. Você pretendia chamá-la em vez disso?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Atualizando a saída do projeto '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Atualizando os carimbos de data/hora de saída do projeto '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Atualizando os carimbos de data/hora de saída inalterados do projeto '{0}'...", + "Use_0_95174": "Use `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Use `Number.isNaN` em todas as condições.", "Use_element_access_for_0_95145": "Usar o acesso de elemento para '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "Usar o acesso de elemento para todas as propriedades não declaradas.", "Use_synthetic_default_member_95016": "Use o membro sintético 'padrão'.", diff --git a/lib/ru/diagnosticMessages.generated.json b/lib/ru/diagnosticMessages.generated.json index 2e5431012e9a1..a0a54a54fab5e 100644 --- a/lib/ru/diagnosticMessages.generated.json +++ b/lib/ru/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Свойство \"{0}\" этого тега JSX ожидает один дочерний объект типа \"{1}\", однако было предоставлено несколько дочерних объектов.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Свойство \"{0}\" этого тега JSX ожидает тип \"{1}\", требующий несколько дочерних объектов, однако был предоставлен только один дочерний объект.", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Это сравнение кажется непреднамеренным, поскольку типы \"{0}\" и \"{1}\" не перекрываются.", + "This_condition_will_always_return_0_2845": "Это условие всегда возвращает \"{0}\".", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Это условие всегда будет возвращать ''{0}'', так как JavaScript сравнивает объекты по ссылке, а не по значению.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Это условие всегда будет возвращать значение true, поскольку функция \"{0}\" всегда определена.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Это условие будет всегда возвращать значение true, поскольку функция всегда определена. Возможно, вы хотите вызвать ее?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "Обновление выходных данных проекта \"{0}\"...", "Updating_output_timestamps_of_project_0_6359": "Обновление меток времени в выходных данных проекта \"{0}\"...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Обновление меток времени в неизменившихся выходных данных проекта \"{0}\"...", + "Use_0_95174": "Использовать \"{0}\".", + "Use_Number_isNaN_in_all_conditions_95175": "Использовать \"Number.isNaN\" во всех условиях.", "Use_element_access_for_0_95145": "Использовать доступ к элементам для \"{0}\".", "Use_element_access_for_all_undeclared_properties_95146": "Использовать доступ к элементам для всех необъявленных свойств.", "Use_synthetic_default_member_95016": "Используйте искусственный элемент \"default\".", diff --git a/lib/tsc.js b/lib/tsc.js index dc10999c8fe55..3188c0a2febae 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -37084,6 +37084,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); if (!(state.features & NodeResolutionFeatures.Exports)) { @@ -37096,12 +37097,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -37111,18 +37107,22 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); if (rest !== "") { - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45898,6 +45898,7 @@ var ts; && symbol.escapedName !== "export=" && !(symbol.flags & 4194304) && !(symbol.flags & 32) + && !(symbol.flags & 8192) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -98345,7 +98346,7 @@ var ts; return { file: file, pos: pos, end: end, packageId: packageId }; } ts.getReferencedFileLocation = getReferencedFileLocation; - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; if (!ts.arrayIsEqualTo(program.getRootFileNames(), rootFileNames)) @@ -98365,7 +98366,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -98573,7 +98574,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { if (!resolved || resolved.extension !== undefined) { @@ -98948,7 +98949,7 @@ var ts; var predictedToResolveToAmbientModuleMarker = {}; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -99133,7 +99134,7 @@ var ts; } modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { structureIsReused = 1; modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } @@ -102654,7 +102655,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -102708,15 +102709,12 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -104806,6 +104804,9 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); watchConfigFileWildCardDirectories(); @@ -104869,9 +104870,9 @@ var ts; resolutionCache.clear(); } } - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -104884,7 +104885,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -104897,7 +104898,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); writeLog(" options: ".concat(JSON.stringify(compilerOptions))); @@ -104907,7 +104908,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); diff --git a/lib/tsserver.js b/lib/tsserver.js index e67fc4a316e02..362721175358c 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -45253,6 +45253,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45267,13 +45268,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45286,19 +45281,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -55479,6 +55479,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -118839,7 +118840,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -118867,7 +118868,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -119113,7 +119114,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -119560,7 +119561,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -119796,7 +119797,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -123842,7 +123843,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123897,17 +123898,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -126287,6 +126284,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -126352,10 +126353,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -126368,7 +126368,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -126381,7 +126381,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -126392,7 +126392,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -139176,7 +139176,7 @@ var ts; break; case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -157958,7 +157958,7 @@ var ts; return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; @@ -168338,7 +168338,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -168369,7 +168369,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -168409,7 +168409,7 @@ var ts; // as a const variable without downleveling, doesn't crash). var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -173703,7 +173703,7 @@ var ts; ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project"); this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName())); var start = ts.timestamp(); - this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution(); + this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse); this.resolutionCache.startCachingPerDirectoryResolution(); this.program = this.languageService.getProgram(); // TODO: GH#18217 this.dirty = false; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 50fbd1d4dea72..575116ceed587 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -3320,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -5442,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 899775079a64d..4c0a2ae5636a0 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -45252,6 +45252,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45266,13 +45267,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45285,19 +45280,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -55478,6 +55478,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -118838,7 +118839,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -118866,7 +118867,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -119112,7 +119113,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -119559,7 +119560,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -119795,7 +119796,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -123841,7 +123842,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123896,17 +123897,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -126286,6 +126283,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -126351,10 +126352,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -126367,7 +126367,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -126380,7 +126380,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -126391,7 +126391,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -139594,7 +139594,7 @@ var ts; break; case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -158376,7 +158376,7 @@ var ts; return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; @@ -168756,7 +168756,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -168787,7 +168787,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -168827,7 +168827,7 @@ var ts; // as a const variable without downleveling, doesn't crash). var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -173702,7 +173702,7 @@ var ts; ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project"); this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName())); var start = ts.timestamp(); - this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution(); + this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse); this.resolutionCache.startCachingPerDirectoryResolution(); this.program = this.languageService.getProgram(); // TODO: GH#18217 this.dirty = false; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index d323d77c229dd..0e6b2559af02e 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -3320,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -5442,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ diff --git a/lib/typescript.js b/lib/typescript.js index 509255acc391f..c396c08f7afa9 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -45243,6 +45243,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45257,13 +45258,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45276,19 +45271,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -55469,6 +55469,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -118829,7 +118830,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -118857,7 +118858,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -119103,7 +119104,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -119550,7 +119551,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -119786,7 +119787,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -123832,7 +123833,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123887,17 +123888,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -126277,6 +126274,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -126342,10 +126343,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -126358,7 +126358,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -126371,7 +126371,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -126382,7 +126382,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -139585,7 +139585,7 @@ var ts; break; case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -158367,7 +158367,7 @@ var ts; return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; @@ -168747,7 +168747,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -168778,7 +168778,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -168818,7 +168818,7 @@ var ts; // as a const variable without downleveling, doesn't crash). var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 93f7c9ed812be..b5f076b36596e 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -3320,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -5442,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 73fab2d45c99a..1df5ef670a2cd 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -45243,6 +45243,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45257,13 +45258,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45276,19 +45271,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -55469,6 +55469,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -118829,7 +118830,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -118857,7 +118858,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -119103,7 +119104,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -119550,7 +119551,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -119786,7 +119787,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -123832,7 +123833,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123887,17 +123888,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -126277,6 +126274,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -126342,10 +126343,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -126358,7 +126358,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -126371,7 +126371,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -126382,7 +126382,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -139585,7 +139585,7 @@ var ts; break; case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -158367,7 +158367,7 @@ var ts; return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; @@ -168747,7 +168747,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -168778,7 +168778,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -168818,7 +168818,7 @@ var ts; // as a const variable without downleveling, doesn't crash). var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 9fc19a4f74c52..2a5b8151dea19 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -45233,6 +45233,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45247,13 +45248,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45266,19 +45261,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -55459,6 +55459,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -118819,7 +118820,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -118847,7 +118848,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -119093,7 +119094,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -119540,7 +119541,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -119776,7 +119777,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -123822,7 +123823,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123877,17 +123878,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -126267,6 +126264,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -126332,10 +126333,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -126348,7 +126348,7 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -126361,7 +126361,7 @@ var ts; compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -126372,7 +126372,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); diff --git a/lib/zh-cn/diagnosticMessages.generated.json b/lib/zh-cn/diagnosticMessages.generated.json index 5764216af598a..a8fb889f014e9 100644 --- a/lib/zh-cn/diagnosticMessages.generated.json +++ b/lib/zh-cn/diagnosticMessages.generated.json @@ -1427,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "算术运算左侧必须是 \"any\"、\"number\"、\"bigint\" 或枚举类型。", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "赋值表达式的左侧不能是可选属性访问。", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "赋值表达式的左侧必须是变量或属性访问。", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "\"in\" 表达式的左侧必须是专用标识符或其类型必须为 \"any\"、\"string\"、\"number\" 或 \"symbol\"。", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "\"instanceof\" 表达式左侧必须是 \"any\" 类型、对象类型或类型参数。", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "向用户显示消息时所用的区域设置(例如,\"en-us\")", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "用于搜索 node_modules 和加载 JavaScript 文件的最大依赖项深度。", @@ -1448,7 +1447,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "异步函数或方法的返回类型必须为全局 Promise 类型。你是否是指写入 \"Promise<{0}>\"?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "\"for...in\" 语句右侧必须是 \"any\" 类型、对象类型或类型参数,但此处的类型为“{0}”。", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "算术运算右侧必须是 \"any\"、\"number\"、\"bigint\" 或枚举类型。", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "\"in\" 表达式的右侧不得是基元。", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "\"instanceof\" 表达式的右侧必须属于类型 \"any\",或属于可分配给 \"Function\" 接口类型的类型。", "The_root_value_of_a_0_file_must_be_an_object_5092": "“{0}”文件的根值必须是一个对象。", "The_shadowing_declaration_of_0_is_defined_here_18017": "在此处定义了“{0}”的阴影声明", @@ -1476,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "此 JSX 标记的 \"{0}\" 属性需要 \"{1}\" 类型的子级,但提供了多个子级。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "此 JSX 标记的 \"{0}\" 属性需要类型 \"{1}\",该类型需要多个子级,但仅提供了一个子级。", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "此比较似乎是无意的,因为类型“{0}”和“{1}”没有重叠。", + "This_condition_will_always_return_0_2845": "此条件将始终返回“{0}”。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "此条件将始终返回“{0}”,因为 JavaScript 按引用而不是值比较对象。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "此条件将始终返回 true,因为此“{0}”已始终定义。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "此条件将始终返回 true,因为始终定义了函数。你是想改为调用它吗?", @@ -1551,6 +1550,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "类型 “{0}” 不能分配给“exactOptionalPropertyTypes: true”的类型 “{1}”。请考虑将 “undefined” 添加到目标类型。。", "Type_0_is_not_comparable_to_type_1_2678": "类型“{0}”不可与类型“{1}”进行比较。", "Type_0_is_not_generic_2315": "类型“{0}”不是泛型类型。", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "类型 \"{0}\" 可以表示基元值,该值不允许作为“in”运算符的右操作数。", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "类型“{0}”必须具有返回异步迭代器的 \"[Symbol.asyncIterator]()\" 方法。", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "类型“{0}”必须具有返回迭代器的 \"[Symbol.iterator]()\" 方法。", "Type_0_provides_no_match_for_the_signature_1_2658": "类型“{0}”提供的内容与签名“{1}”不匹配。", @@ -1649,6 +1649,8 @@ "Updating_output_of_project_0_6373": "正在更新项目 \"{0}\" 的输出…", "Updating_output_timestamps_of_project_0_6359": "正在更新项目“{0}”的输出时间戳...", "Updating_unchanged_output_timestamps_of_project_0_6371": "正在更新项目 \"{0}\" 未更改的输出时间戳…", + "Use_0_95174": "使用 `{0}`", + "Use_Number_isNaN_in_all_conditions_95175": "在所有条件下使用 `Number.isNaN`。", "Use_element_access_for_0_95145": "对“{0}”使用元素访问", "Use_element_access_for_all_undeclared_properties_95146": "对所有未声明的属性使用元素访问。", "Use_synthetic_default_member_95016": "使用综合的“默认”成员。", diff --git a/lib/zh-tw/diagnosticMessages.generated.json b/lib/zh-tw/diagnosticMessages.generated.json index 7ce669bd2f022..065df6681f37a 100644 --- a/lib/zh-tw/diagnosticMessages.generated.json +++ b/lib/zh-tw/diagnosticMessages.generated.json @@ -1474,6 +1474,7 @@ "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "此 JSX 標籤的 '{0}' 屬性只能有一個 '{1}' 類型的子系,但提供的子系卻有多個。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "此 JSX 標籤的 '{0}' 屬性需要必須有多個子系的類型 '{1}',但僅提供的子系只有一個。", "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "此比較似乎是無意的,因為類型 '{0}' 和 '{1}' 沒有重疊。", + "This_condition_will_always_return_0_2845": "此條件一律傳回 '{0}'。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "此條件一律會傳回 '{0}',因為 JavaScript 會依參照而非值比較物件。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "因為此 '{0}' 一律會被定義,所以此條件一律傳回 True。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "因為永遠會定義此函式,所以此條件永遠會傳回 true。您是要改為呼叫該條件嗎?", @@ -1648,6 +1649,8 @@ "Updating_output_of_project_0_6373": "正在更新專案 '{0}' 的輸出...", "Updating_output_timestamps_of_project_0_6359": "正在更新專案 '{0}' 的輸出時間戳記...", "Updating_unchanged_output_timestamps_of_project_0_6371": "正在更新專案 '{0}' 的未更變輸出時間戳記...", + "Use_0_95174": "使用 `{0}`。", + "Use_Number_isNaN_in_all_conditions_95175": "在所有條件中都使用 'Number.isNaN'。", "Use_element_access_for_0_95145": "對 '{0}' 使用元素存取", "Use_element_access_for_all_undeclared_properties_95146": "對所有未宣告的屬性使用元素存取。", "Use_synthetic_default_member_95016": "使用綜合 'default' 成員。", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5b48d317db7df..74abd84b43665 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -748,7 +748,7 @@ namespace ts { newOptions: CompilerOptions, getSourceVersion: (path: Path, fileName: string) => string | undefined, fileExists: (fileName: string) => boolean, - hasInvalidatedResolution: HasInvalidatedResolution, + hasInvalidatedResolutions: HasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: HasChangedAutomaticTypeDirectiveNames | undefined, getParsedCommandLine: (fileName: string) => ParsedCommandLine | undefined, projectReferences: readonly ProjectReference[] | undefined @@ -782,7 +782,7 @@ namespace ts { function sourceFileNotUptoDate(sourceFile: SourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile: SourceFile) { @@ -1076,7 +1076,7 @@ namespace ts { let moduleResolutionCache: ModuleResolutionCache | undefined; let typeReferenceDirectiveResolutionCache: TypeReferenceDirectiveResolutionCache | undefined; let actualResolveModuleNamesWorker: (moduleNames: string[], containingFile: SourceFile, containingFileName: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference) => ResolvedModuleFull[]; - const hasInvalidatedResolution = host.hasInvalidatedResolution || returnFalse; + const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) => host.resolveModuleNames!(Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(resolved => { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -1557,7 +1557,7 @@ namespace ts { for (let i = 0; i < moduleNames.length; i++) { const moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { const oldResolvedModule = getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (isTraceEnabled(options, host)) { @@ -1822,7 +1822,7 @@ namespace ts { // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = StructureIsReused.SafeModules; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 27b863a3abf3c..732a1114229ff 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -14,7 +14,7 @@ namespace ts { removeResolutionsOfFile(filePath: Path): void; removeResolutionsFromProjectReferenceRedirects(filePath: Path): void; setFilesWithInvalidatedNonRelativeUnresolvedImports(filesWithUnresolvedImports: ESMap): void; - createHasInvalidatedResolution(customHasInvalidatedResolution: HasInvalidatedResolution): HasInvalidatedResolution; + createHasInvalidatedResolutions(customHasInvalidatedResolutions: HasInvalidatedResolutions): HasInvalidatedResolutions; hasChangedAutomaticTypeDirectiveNames(): boolean; isFileWithInvalidatedNonRelativeUnresolvedImports(path: Path): boolean; @@ -236,7 +236,7 @@ namespace ts { invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution, + createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch, closeTypeRootsWatch, @@ -300,12 +300,12 @@ namespace ts { return !!value && !!value.length; } - function createHasInvalidatedResolution(customHasInvalidatedResolution: HasInvalidatedResolution): HasInvalidatedResolution { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions: HasInvalidatedResolutions): HasInvalidatedResolutions { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); const collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return path => customHasInvalidatedResolution(path) || + return path => customHasInvalidatedResolutions(path) || !!collected?.has(path) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f63c1f21078bc..66e55ab58b381 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7179,7 +7179,7 @@ namespace ts { } /* @internal */ - export type HasInvalidatedResolution = (sourceFile: Path) => boolean; + export type HasInvalidatedResolutions = (sourceFile: Path) => boolean; /* @internal */ export type HasChangedAutomaticTypeDirectiveNames = () => boolean; @@ -7216,7 +7216,7 @@ namespace ts { /* @internal */ onReleaseOldSourceFile?(oldSourceFile: SourceFile, oldOptions: CompilerOptions, hasSourceFileByPath: boolean): void; /* @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; /* @internal */ hasChangedAutomaticTypeDirectiveNames?: HasChangedAutomaticTypeDirectiveNames; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 788a8856f3a58..26c6deb9a259a 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -113,7 +113,7 @@ namespace ts { /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ @@ -373,9 +373,9 @@ namespace ts { maybeBind(host, host.getModuleResolutionCache) : (() => resolutionCache.getModuleResolutionCache()); const userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; - // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolution - const customHasInvalidatedResolution = userProvidedResolution ? - maybeBind(host, host.hasInvalidatedResolution) || returnTrue : + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + const customHasInvalidatedResolutions = userProvidedResolution ? + maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost) as any as T; @@ -449,12 +449,12 @@ namespace ts { } } - const hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(customHasInvalidatedResolution); + const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); const { originalReadFile, originalFileExists, originalDirectoryExists, originalCreateDirectory, originalWriteFile, } = changeCompilerHostLikeToUseCache(compilerHost, toPath); - if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileName => compilerHost.fileExists(fileName), hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileName => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -467,7 +467,7 @@ namespace ts { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; @@ -484,7 +484,7 @@ namespace ts { return builderProgram; } - function createNewProgram(hasInvalidatedResolution: HasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions: HasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(` roots: ${JSON.stringify(rootFileNames)}`); @@ -495,7 +495,7 @@ namespace ts { hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; const oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); diff --git a/src/server/project.ts b/src/server/project.ts index 8a45bab06057f..05e6442a84c42 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -172,7 +172,7 @@ namespace ts.server { readonly realpath?: (path: string) => string; /*@internal*/ - hasInvalidatedResolution: HasInvalidatedResolution | undefined; + hasInvalidatedResolutions: HasInvalidatedResolutions | undefined; /*@internal*/ resolutionCache: ResolutionCache; @@ -1176,7 +1176,7 @@ namespace ts.server { Debug.assert(!this.isClosed(), "Called update graph worker of closed project"); this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`); const start = timestamp(); - this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution(returnFalse); + this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(returnFalse); this.resolutionCache.startCachingPerDirectoryResolution(); this.program = this.languageService.getProgram(); // TODO: GH#18217 this.dirty = false; diff --git a/src/services/services.ts b/src/services/services.ts index a2078b875a568..975e36b1dd40c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1300,7 +1300,7 @@ namespace ts { // Get a fresh cache of the host information const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - const hasInvalidatedResolution: HasInvalidatedResolution = host.hasInvalidatedResolution || returnFalse; + const hasInvalidatedResolutions: HasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse; const hasChangedAutomaticTypeDirectiveNames = maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); const projectReferences = host.getProjectReferences?.(); let parsedCommandLines: ESMap | undefined; @@ -1332,7 +1332,7 @@ namespace ts { }, onReleaseOldSourceFile, onReleaseParsedCommandLine, - hasInvalidatedResolution, + hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, trace: maybeBind(host, host.trace), resolveModuleNames: maybeBind(host, host.resolveModuleNames), @@ -1369,7 +1369,7 @@ namespace ts { const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), fileName => compilerHost!.fileExists(fileName), hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), fileName => compilerHost!.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } diff --git a/src/services/types.ts b/src/services/types.ts index d22416abb0b50..915b7b71c8394 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -287,7 +287,7 @@ namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined; resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; - /* @internal */ hasInvalidatedResolution?: HasInvalidatedResolution; + /* @internal */ hasInvalidatedResolutions?: HasInvalidatedResolutions; /* @internal */ hasChangedAutomaticTypeDirectiveNames?: HasChangedAutomaticTypeDirectiveNames; /* @internal */ getGlobalTypingsCacheLocation?(): string | undefined; /* @internal */ getSymlinkCache?(files?: readonly SourceFile[]): SymlinkCache; diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 3e9e5f2313441..eda2135323d9c 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -934,7 +934,7 @@ namespace ts { return isProgramUptoDate( program, newRootFileNames, newOptions, path => program.getSourceFileByPath(path)!.version, /*fileExists*/ returnFalse, - /*hasInvalidatedResolution*/ returnFalse, + /*hasInvalidatedResolutions*/ returnFalse, /*hasChangedAutomaticTypeDirectiveNames*/ undefined, /*getParsedCommandLine*/ returnUndefined, /*projectReferences*/ undefined diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index cfcbc115a69f4..8182e276d9617 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -50,7 +50,7 @@ namespace ts.tscWatch { }); }); - describe("hasInvalidatedResolution", () => { + describe("hasInvalidatedResolutions", () => { function verifyWatch(subScenario: string, implementHasInvalidatedResolution: boolean) { it(subScenario, () => { const { sys, baseline, oldSnap, cb, getPrograms } = createBaseline(createWatchedSystem({ @@ -70,7 +70,7 @@ namespace ts.tscWatch { host.resolveModuleNames = (moduleNames, containingFile, _reusedNames, _redirectedReference, options) => moduleNames.map(m => resolveModuleName(m, containingFile, options, host).resolvedModule); // Invalidate resolutions only when ts file is created - if (implementHasInvalidatedResolution) host.hasInvalidatedResolution = () => sys.fileExists(`${projectRoot}/other.ts`); + if (implementHasInvalidatedResolution) host.hasInvalidatedResolutions = () => sys.fileExists(`${projectRoot}/other.ts`); const watch = createWatchProgram(host); runWatchBaseline({ scenario: "watchApi", @@ -104,8 +104,8 @@ namespace ts.tscWatch { }); }); } - verifyWatch("host implements does not implement hasInvalidatedResolution", /*implementHasInvalidatedResolution*/ false); - verifyWatch("host implements hasInvalidatedResolution", /*implementHasInvalidatedResolution*/ true); + verifyWatch("host implements does not implement hasInvalidatedResolutions", /*implementHasInvalidatedResolution*/ false); + verifyWatch("host implements hasInvalidatedResolutions", /*implementHasInvalidatedResolution*/ true); }); }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 7b3d74e82987d..575116ceed587 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3321,7 +3321,7 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -5445,7 +5445,7 @@ declare namespace ts { /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index d65d6e1054086..0e6b2559af02e 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3321,7 +3321,7 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -5445,7 +5445,7 @@ declare namespace ts { /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ - hasInvalidatedResolution?(filePath: Path): boolean; + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ diff --git a/tests/baselines/reference/tscWatch/watchApi/host-implements-does-not-implement-hasInvalidatedResolution.js b/tests/baselines/reference/tscWatch/watchApi/host-implements-does-not-implement-hasInvalidatedResolutions.js similarity index 100% rename from tests/baselines/reference/tscWatch/watchApi/host-implements-does-not-implement-hasInvalidatedResolution.js rename to tests/baselines/reference/tscWatch/watchApi/host-implements-does-not-implement-hasInvalidatedResolutions.js diff --git a/tests/baselines/reference/tscWatch/watchApi/host-implements-hasInvalidatedResolution.js b/tests/baselines/reference/tscWatch/watchApi/host-implements-hasInvalidatedResolutions.js similarity index 100% rename from tests/baselines/reference/tscWatch/watchApi/host-implements-hasInvalidatedResolution.js rename to tests/baselines/reference/tscWatch/watchApi/host-implements-hasInvalidatedResolutions.js